You are given a 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
message
3
Sample Output 1
message message message
Sample Input 2
pop
4
Sample Output 2
pop pop pop pop
msg=input("String: ")
N = int(input("Times: "))
out=(msg+" ")*N
print(out)
Comments
Leave a comment