

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 5
click for more info
Not enough gems
Cost: 6 gems
1: Number Sum
incomplete
2: Find Min
incomplete
3: Remove Non-Integers
incomplete
4: Factorial
incomplete
5: Area Sum
incomplete
6: List Division
incomplete
7: Join Strings
incomplete
8: Unit Tests
incomplete
9: Fix a Failing Test
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
A factorial is the product (multiplication result) of all positive integers less than or equal to a given number. For example:
1! = 1 = 12! = 2 * 1 = 23! = 3 * 2 * 1 = 64! = 4 * 3 * 2 * 1 = 245! = 5 * 4 * 3 * 2 * 1 = 120There's also a special case for zero:
0! = 1It's just 1 by definition of the fancy math folks (ivory tower types).
Complete the factorial() function. It should return the factorial of a given number.
In mathematics, the ! symbol denotes a factorial, but is not a valid Python Factorial operator. Use a loop and multiplication to compute the proper result.