I want to take a function and repeat it by an amount which a user will input. Thanks in advance!

Recommended Answers

All 2 Replies

Use for loop with range.

Like Tony recommends:

def ten_times(n):
    print(n*10)

x = int(input("How many repeats (enter an integer value): "))

for n in range(x):
    ten_times(n+1)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.