11Factorial
Easyloopsmath
Write factorial(n) that returns n! = 1 × 2 × 3 × … × n.
By definition factorial(0) is 1.
Examples
Example 1
>>> factorial(5) 120
Example 2
>>> factorial(0) 1
Good to know
nis never negative.
Run examples checks the 2 examples above. Submit runs all 6 tests, including hidden edge cases, and marks the challenge solved.