Sometimes we need to repeat the string in the program, and we can do this easily by using the repetition operator in Python.

The repetition operator is denoted by a '*' symbol and is useful for repeating strings to a certain length.

Example:
str = 'Python program'
print(str*3)

The above lines of code will display the following outputs:

Python programPython programPython program

Similarly, it is also possible to repeat any part of the string by slicing:

Example:
str = 'Python program'
print(str[7:9]*3) #Repeats the seventh and eighth character three times
prprpr