Algorithms
Logic
Mathematics
Numbers
Return the factorial of a given input number.
Note that the number must be equal or greater than 1.
i.e.:
factorial(6) = 720
factorial(5) = 120
def factorial(x):
return 1 if x == 1 else x*factorial(x-1)
test.assert_equals(factorial(6), 720, "Wrong calculation!")
test.assert_equals(factorial(10), 3628800, "Wrong calculation!")