@wilburn
Функцию можно вызывать в цикле или с использованием рекурсии. Вот несколько примеров:
1 2 3 4 5 |
def my_function(): print("Hello!") for _ in range(5): my_function() |
1 2 3 4 5 6 7 |
def my_function(): print("Hello!") counter = 0 while counter < 5: my_function() counter += 1 |
1 2 3 4 5 6 7 |
def my_function(counter): if counter == 0: return print("Hello!") my_function(counter - 1) my_function(5) |