Question: Python allows you to repeat a string by multiplying it by an integer, e.g. 'Hi' * 3 will give 'HiHiHi'. Pretend that this feature does
Python allows you to repeat a string by multiplying it by an integer, e.g. 'Hi' * 3 will give 'HiHiHi'. Pretend that this feature does not exist, and instead write a function named repeat that accepts a string and an integer as arguments. The function should return a string of the original string repeated the specified number of times, e.g. repeat('Hi', 3) should return 'HiHiHi'.
Step by Step Solution
3.48 Rating (161 Votes )
There are 3 Steps involved in it
Here is a Python function named repeat that accepts a string and an integer as ... View full answer
Get step-by-step solutions from verified subject matter experts
