programming-examples/python/Basics/Get a string which is n (non-negative integer) copies of a given string.py
2019-11-18 14:44:36 +01:00

8 lines
194 B
Python

def larger_string(str, n):
result = ""
for i in range(n):
result = result + str
return result
print(larger_string('abc', 2))
print(larger_string('.py', 3))