Repeat User Input
Beginner
Repeat User Input Challenge
In this fun and simple challenge, your task is to create a function, repeat_user_input, that takes two parameters:
- A string
user_input- which represents what the user has entered. - An integer
n- which tells how many times theuser_inputshould be repeated.
Your function should return the string user_input repeated n times, concatenated together.
Examples:
repeat_user_input("Hello", 3) # returns "HelloHelloHello" repeat_user_input("Fun", 2) # returns "FunFun" repeat_user_input("Python", 1) # returns "Python" repeat_user_input("Go", 0) # returns ""
Try to think about what happens when n is zero or more than one! This exercise will help you practice string manipulation and loop structures in Python. Enjoy coding!
Inputs
Arg 1:
"Hello"Arg 2:
3Expected Output
"HelloHelloHello"Actual Output