Write a recursive function to find the factorial of a number n.

def factorial(n):               if n == 1 or n == 0:                               return 1               else:                               return n * factorial(n-1)

MB

Related Python Mentoring answers

All answers ▸

How do I check if a number is prime using a python program?


Write a function that checks whether a number is prime or not.


What can be used to iterate through a list in python?


What's the difference between a local and a global variable?