Learning Factorials with Loop/Recursion @ Dcoder

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)))
H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center