diff --git a/snippets/python/math-and-numbers/find-factorial.md b/snippets/python/math-and-numbers/find-factorial.md index 939e8fa6..23a28ac9 100644 --- a/snippets/python/math-and-numbers/find-factorial.md +++ b/snippets/python/math-and-numbers/find-factorial.md @@ -3,13 +3,14 @@ title: Find Factorial description: Calculates the factorial of a number. author: dostonnabotov tags: python,math,factorial,utility +contributors: starryknight64 --- ```py +import math + def factorial(n): - if n == 0: - return 1 - return n * factorial(n - 1) + return math.factorial(n) # Usage: print(factorial(5)) # Output: 120