Advertisement
Fhernd

suma-recursiva.py

Mar 18th, 2018
1,019
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.21 KB | None | 0 0
  1. def sumar(operandos):
  2.     operando1, *operandos_restantes = operandos
  3.    
  4.     return operando1 + sumar(operandos_restantes) if operandos_restantes else operando1
  5.    
  6. operandos = [2, 3, 5, 7, 11, 13]
  7.  
  8. print(sumar(operandos))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement