Guest User

Python Factorial Finder Recursive Function

a guest
Aug 30th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. # Factorial finder recursive function
  2.  
  3. def f(x):
  4.     if x == 1: # base case
  5.         return 1
  6.     else:
  7.         return x * f(x-1) # recursion case
  8.  
  9.  
  10. # Test:
  11. print(f(994)) # the biggest number for Python to calculate the factorial of
Add Comment
Please, Sign In to add comment