def tail_factorial(n, res): if n == 0: return res return tail_factorial(n-1, n*res) def factorial(num): return tail_factorial(num, 1)
from math import factorial as code- def tail_factorial(n, res):
- if n == 0:
- return res
- return tail_factorial(n-1, n*res)
def factorial(wars):return code(wars)- def factorial(num):
- return tail_factorial(num, 1)