My issue
def Factorial(n):
# Write your code here
n = int(input())
print(Factorial(n))
My code
def Factorial(n):
# Write your code here
n = int(input())
print(Factorial(n))
Learning course: Design and Analysis of Algorithms
Problem Link: Factorial in Design and Analysis of Algorithms
Factorial
Task
Given an integer
π
N, calculate and output the factorial of a
π
N.
Factorial of an integer
π
N is the product of first
π
N natural numbers.
Recursive equation for Factorial:
πΉ
π
π
π‘
π
π
π
π
π
(
π
)
π
β
πΉ
π
π
π‘
π
π
π
π
π
(
π
β
1
)
Factorial(n)=NβFactorial(nβ1),
πΉ
π
π
π‘
π
π
π
π
π
(
0
)
1
Factorial(0)=1,
πΉ
π
π
π‘
π
π
π
π
π
(
1
)
1
Factorial(1)=1
Input Format
Input contains a single integer
π
N
Output Format
Output the Factorial of
π
N
Sample 1:
Input
Output
5
120
Explanation:
1
Γ
2
Γ
3
Γ
4
Γ
5
120
1Γ2Γ3Γ4Γ5=120
Sample 2:
Input
Output
0
1
Explanation:
Factorial of
0
0 is
1
1