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 ▸

Create a python code to sum the number from 1 to 10.


What is the difference between a FOR loop and WHILE loop and how do I write them?


What is the difference between using range() and a list of values?


When do we use a for-loop and when a while-loop?