Learning Factorials with Loop/Recursion @ Dcoder

Words
49
Reading
1 min
3y
Listen to this post
~1 min

Problem: If n is an integer greater than 0, n factorial (n!) is the product: n* (n-1) * (n-2) * ( n-3)… *
By convention, 0! = 1.
Write a Program to compute n Factorial(n!), where n is input.
Input: n is a positive integer
Output: Output will be n factorial(n!)
Constraints: 0<=n<=12
Sample Input: 4
Sample Output:
24

from functools import reduce
from operator import __mul__
print(reduce(__mul__, range(1, int(input())+1)))
Learning Factorials with Loop/Recursion @ Dcoder | Ecency