KYS KYS - 5 days ago 5
Python Question

How to repeat a string in Python?

I want to print

snirtsnirtsnirtsnirtsnirtsnirtsnirtsnirtsnirtsnirt

snirtsnirtsnirtsnirtsnirtsnirtsnirtsnirtsnirtsnirt


by using

print('''10*'snirt'
10*'snirt' ''')


but this python thing would only print

'10*'snirt''

10*'snirt'


what should i adjust?

Answer

This does the trick:

print("snirt" * 10 + "\n" + "snirt" * 10)
Comments