You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# recursion is a useful tool in mainly functional-programming languages. A function is called again and again to evaluate statements. Useful and powerful.
def factorial(num):
if num == 1: # make a base condition so that the function doesn't go to negative indexes.
return 1
else:
return (num*factorial(num-1)) # the same function will be run against the number.
number = int(input("Enter a number for factorial.\t"))