Recursion · 9 / 18 Exercise Medium

Calculate the factorial of a number

Objective

Create a Python program with a recursive function that calculates the factorial of an integer entered by the user.

Instructions

  • Ask the user for an integer.
  • Implement a recursive function that calculates the factorial of the number.
  • Print the result on the screen.
Input
6
Output
720

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise