Recursive factorial function. : Recursive function : Function PYTHON TUTORIALS


PYTHON TUTORIALS » Function » Recursive function »

 

Recursive factorial function.


def factorialnumber ):

   if number <= 1:   # base case
      return 1
   else:
      return number * factorialnumber - )  # recursive call

for i in range11 ):
   print "%2d! = %d" i, factorial) )



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Function
» Recursive function