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)

Answered by Micah B. Python tutor

848 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

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


Create a program that checks for syntactical errors in an email address.


Explain how python programs are structured and give an example of how methods are initiated


What built-in types does python provide?


We're here to help

contact us iconContact usWhatsapp logoMessage us on Whatsapptelephone icon+44 (0) 203 773 6020
Facebook logoInstagram logoLinkedIn logo

© MyTutorWeb Ltd 2013–2024

Terms & Conditions|Privacy Policy