Answer to Question #318369 in Python for string repitition

Question #318369

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


1
Expert's answer
2022-03-26T02:39:29-0400
str = input("Input message: ")
n = int(input("Input number N: "))
print((str + " ") * n)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS