teslariu

listas y for

Jun 27th, 2023
1,283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Script que imprime una lista de nombres verticalmente
  5.  
  6. lista = ["Juana", "Ana", "Abel", "Luis", "María"]
  7.  
  8. i = 0
  9. while i < len(lista):
  10.     print(lista[i])
  11.     i = i + 1
  12.    
  13. # SPOILER: en los ciclos DEFINIDOS USAR for
  14. for nombre in lista:
  15.     print(nombre)
  16.  
Advertisement
Add Comment
Please, Sign In to add comment