SHARE
TWEET

Python Factorial Finder Recursive Function

a guest Aug 30th, 2016 30 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top