Question: 5 . 4 2 LAB: Repeating a string Write a function def repeat ( string , n , delim ) that returns the string string
LAB: Repeating a string
Write a function def repeat string delim that returns the string string repeated times, separated by the string delim ex space, # etc
Ex: If the input is:
Enter a string: hello
How many repetitions?
Separated by #
then the output is:
hello#hello#hello#hello#hello
Your program will also need a main function to
get input of the string, repetitions, and delimiter and
call the function, and
prints the results.
Ex: If the input is:
Enter a string: world
How many repetitions?
Separated by $
then the output is:
world$world$world
LAB ACTIVITY
: LAB: Repeating a string
main.py
Load default template...
#
## Repeat a string times, with each repetition seperated by delim.
# @param string the string of characters to repeat
# @param the number of repetitions
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
