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 an rock, paper, scissors game. The user should input one option, and the computer should play randomly.


Which four data types are used in Python? Can you give an example of each?


What built-in types does python provide?


When to use a dectionary or a list