Recursions in Python

Factorial Numbers:

# Factorial Numbers are n* (n-1) like:

#4!= 4*3*2*1

#!1 = 1

#0! = 1

 def factorial(n):

    if n==0 or n==1:
return 1
return n * factorial(n-1)
print("Enter The Number")
fac = factorial( int(input()))
print(fac)

Comments

Popular posts from this blog

Practice Execise 3

Pickle Module