String repetition-4
you are a given string.repeat the same string N times separated by space.
explanation
in the given example the string is messages , N = 3 .
so we have to repeat the string three times.then we get messages messages messages
as output
sample input 1
messages
3
sample output 1
messages messages messages
sample input 2
pop
4
sample output 2
pop pop pop pop
str = input("Input message: ")
n = int(input("Input number N: "))
print((str + " ") * n)
Comments
Leave a comment