-1

I want to print an input in a variable and then print that variable several times, but here's the thing, I want it in different lines. Is it possible? Thanks!

song = input('song ')   

favorite = song 
print(favorite * 3)

song lala land
lala landlala landlala land
khelwood
  • 55,782
  • 14
  • 81
  • 108
Maxx
  • 1
  • 1
  • @khelwood yeah I saw that too, but It's not what I ask. I didn't find anything like my question before. Thanks! – Maxx May 18 '20 at 17:49

1 Answers1

0

You can use a list and use '\n'.join on it:

song = input('song ')

favorite = song

print('\n'.join([favorite] * 3))

Or you can make use of the sep parameter of the print function:

print(*([favorite] * 3), sep = '\n')
DjaouadNM
  • 22,013
  • 4
  • 33
  • 55