Advertisement
teslariu

ej

May 8th, 2021
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # 1 condicional y 2 bucles
  5. # if  while for
  6. """
  7. numero = 10
  8. while numero < 100:
  9.    print(numero)
  10.    numero = numero + 10
  11. """
  12.  
  13. # Programa que toma una lista de nombres e imprime aquellos que empiezan
  14. #con "A":
  15.  
  16. nombres =  ["Ana", "Juana", "Luisa", "Alejandro","Tomas", "Enrique"]
  17.  
  18. indice = 0
  19. while indice < len(nombres):
  20.     #if nombres[indice][0] == "A":
  21.     #if "A" in nombres[indice]:
  22.     if nombres[indice].startswith("A"):
  23.         print(nombres[indice])
  24.     indice = indice + 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement