Advertisement
Fhernd

factorial-recursivo.py

Feb 2nd, 2018
654
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.19 KB | None | 0 0
  1. def factorial(numero):
  2.     """
  3.     Calcula el factorial de un número de forma recursiva.
  4.     """
  5.     if numero == 1:
  6.         return 1
  7.     else:
  8.         return numero * factorial(numero - 1)
  9.        
  10. print(factorial(7))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement