Skip to content

Instantly share code, notes, and snippets.

@RaMSFT
Created October 12, 2022 13:55
Show Gist options
  • Select an option

  • Save RaMSFT/82985e1393de3ea90bf1caa567af34a9 to your computer and use it in GitHub Desktop.

Select an option

Save RaMSFT/82985e1393de3ea90bf1caa567af34a9 to your computer and use it in GitHub Desktop.
def text_repetition(txt, reps):
"""returns repeated text
Args:
txt (string)
reps (number)
Returns:
string: given string is repeated upto given number of times
"""
#multiplication operator repeats the string
result = txt * reps
return result
print(text_repetition("ab", 3))
print(text_repetition("ram", 10))
print(text_repetition("kiwi", 4))
print(text_repetition("edabit", 2))
print(text_repetition("medium", 4))
print(text_repetition("python", 10))
print(text_repetition("learn", 5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment