Pass Task 2.2P: Recursive Factorial
Task description:
The factorial of a nonnegative integer n, written n! (pronounced “ n factorial ” ), is the product of n* (n – 1)* (n – 2)* … * 1 . And
1! = 1
0! = 1
Recursive definition of the factorial function n! = n * (n – 1)! Example:
5! = 5 * 4 * 3 * 2 * 1
5! = 5 * ( 4 * 3 * 2 * 1)
5! = 5 * ( 4! )
Define a function which accepts a passed argument and calculates its factorial. A program accepts user’s input and calls the function. (Please use recursive function call in the function definition.)
(Sample output as shown in the following figure is for demonstration purposes only.)
Submission:
Submit the following files to OnTrack:
1. Your program source code (e.g. task2-2.py)
2. A screen shot of your program running
Check the following things before submitting:
1. Add proper comments to your code
Students succeed in their courses by connecting and communicating with an expert until they receive help on their questions
Consult our trusted tutors.