Python program to get a string which is n (non-negative integer) copies of a given string.


Topic: Python program to get a string which is n (non-negative integer) copies of a given string.

Solution

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



List all Python Programs