Using the shared code editor, write a recursive function for calculating a factorial of an input parameter.

def factorial(x): #base case if x == 1:    return 1 #recursive call  else:    return (x * factorial(x-1))Recursive algorithms are written using a strategy called divide and conquer. You try and break the problem up into a small repeatable sub-task.

CS

Related Python Mentoring answers

All answers ▸

Write a simple number guessing game, give the user 3 tries to guess a number between 1 and 10


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


What is Object-Oriented Programming?


Write a Python script to take a product name as input and then automatically google search reviews for it and open the top 3 search results in different tabs