How we can print sth n times in n line in python? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 2

How we can print sth n times in n line in python?

for example if program get 4 from input print hello 4 times in 4 lines.

20th Feb 2018, 8:14 PM
mohamadjavad
mohamadjavad - avatar
2 Respostas
+ 5
or even smaller: x = int(input()) print (('hello '*x + '\n' )*x)
20th Feb 2018, 10:42 PM
Obbu
Obbu - avatar
+ 3
there we go šŸ˜…
20th Feb 2018, 10:47 PM
Obbu
Obbu - avatar