Answer:
def doMyMath(n):
if n == 1:
return n
else:
return n*doMyMath(n-1)
Step-by-step explanation:
This line defines the function
def doMyMath(n):
This line checks if n is 1. If yes, it returns n (1)
if n == 1:
return n
If otherwise, it calculates the fibonacci recursively
else:
return n*doMyMath(n-1)
To call the function from main, you can use:
print(doMyMath(5))
or
num = int(input("Number: ")) --- This gets the number from user
print("Result: ",doMyMath(num)) --- This calculates the factorial
This question is answered in Python