How to repeat a string n times in Python
In this tutorial, we are going to learn about how to repeat a string n (number) of times in Python.
Repeating a string
We can a repeat a string n times by multiplying the string
with a specificed number in Python.
Here is an example, that repeats the name
string 3 times:
name = "apple"
repeated = name * 3
print (repeated)
Output:
appleappleapple