Print a String N times
We can output a string N times using the multiplication operator (*)
Python: 3.0    Anurag Rana    29 Jan 2022   0
Login to upvote
1
2
3
4
5
n = 3

str1 = "Hello World!"

print(str1 * n)
Copy | Download as: .py file   PNG
Share on: FB   Twitter   LinkedIn   WA
©2021 - code108labs   Contributors   Hosted on DigitalOcean   Partner website: pythoncircle.com