Monday, August 10, 2020

IslandT: Repeat repeat and more repeat with Python

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

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...