In this article, we are going to revisit CodeWars and solve a simple problem using Python. The problem is as follows.
Write a Python function that will repeat the given string with the number of times that string supposed to be repeated. The solution to this question is as follows.
def repeat_str(repeat, string): repeatString = '' for i in range(0, repeat): repeatString += string return repeatString
As you can see from above, the repeated string will be returned to the caller of this function.
from Planet Python
via read more
No comments:
Post a Comment