Advertisement
GastonPalazzo

Bucles_1 - Ej-5

Aug 31st, 2020
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. #funciones
  2. def suma(l):
  3.     r=0
  4.     for i in l:
  5.         r+=i
  6.     return r
  7.  
  8. def multip(l):
  9.     r=1
  10.     for i in l:
  11.         r*=i
  12.     return r
  13.  
  14. #main
  15. print('\n|Ej 5|')
  16.  
  17. listaA=[1,2,3,4]
  18.  
  19. print(f'\nSuma de elementos de lista a = {suma(listaA)}')
  20.  
  21. print(f'\nMultiplicacion de elementos de lista a = {multip(listaA)}')
  22.  
  23. print('\nFin de la ejecucion!\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement