Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
just use Python's ressources solution in Clear category for Number With Exclamation by mu_py
# if a solution already exists, just use it
from math import factorial
# When I first saw a solution like this one, I shouted "That's cheating!".
# Nowadays I'd rather say: don't re-event the wheel, that is:
# check if a solution already exists in Python's large library
# I think that's an important concept. That's why I decided to share this solution in "Clear"
print("Example:")
print(factorial(4))
# These "asserts" are used for self-checking
assert factorial(0) == 1
assert factorial(1) == 1
assert factorial(5) == 120
assert factorial(10) == 3628800
assert factorial(15) == 1307674368000
print("The mission is done! Click 'Check Solution' to earn rewards!")
Oct. 10, 2024
Comments: