How we can print sth n times in n line in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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 Answers
+ 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