programming-examples/python/_Basics/Get a string which is n (non-negative integer) copies of a given string.py

8 lines
194 B
Python
Raw Normal View History

2019-11-15 12:59:38 +01:00
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))