Python - Factorial of a Number using Recursion
I have given here python program to find the facorial of a number using Recursion.
This code is tested with Python version 2.6
def Fact(n): if( n <= 1): return 1 return n * Fact(n - 1) print "Program to find Factorial of a Number" val = 0 print "Enter a number: ", val = input() print val, "! = ", Fact(val) #sample output #Program to find Factorial of a Number #Enter a number: 5 #5 ! = 120
|