Advertisement
teslariu

zip range

Mar 31st, 2022
1,174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. """
  5. for <iterador> in <iterable>:
  6.  
  7. Un iterable es una variable, TODA COLECCION ES ITERABLE
  8.  
  9. lista = ["Ana", "Victor", "Tito"]
  10.  
  11. for nombre in lista:
  12.     print(nombre)
  13.  
  14.  
  15. # como imprimir un diccionario 
  16. dicc = {"Juan":23, "Ana":14}
  17.  
  18. for k,v in dicc.items():
  19.     print(k,v)
  20.    
  21.  
  22. for numero in range(100,0,-5):
  23.     print(numero, numero**2)
  24.    
  25. """
  26. alumnos = ["Ana", "Victor", "Tito"]
  27. notas = [10,5,8]
  28.  
  29. for alumno,nota in zip(alumnos,notas):
  30.     print(alumno,nota)
  31.    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement