Repeat String for Given Number of Times using Python

Multiplication operator

text = '+-'
n = 5
result = text * n

print(result)  # +-+-+-+-+-

Leave a Comment

Cancel reply

Your email address will not be published.