In Python, you don't need to repeat commands/functions to print a string. You can simply implement it like: n = 2 s = "programming" print( s * n)