Advertisement
teslariu

condicional 2

Aug 23rd, 2022
766
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # condicional: es una estructura lògica que decide entre una o mas opciones
  5. # if - else
  6. """
  7. Script que pide una edad y devuelve su condicion frente al voto
  8. EJ
  9. edad menor a 16 años: voto prohibido
  10. 16 años cumplidos y menos de 18: voto optativo
  11. 18 cumplidos y menos de 70: voto obligatorio
  12. 70 o mas: voto optativo
  13. """
  14. edad = int(input("Ingrese edad: "))
  15.  
  16. if(0 < edad <16):
  17.     print("voto prohibido")
  18.  
  19. elif(16 <= edad < 18  or 70 <= edad <= 130):
  20.     print("voto optativo")
  21.  
  22. elif(18 <= edad < 70):
  23.     print("voto obligatorio")
  24.  
  25. else:
  26.     print(f"Error: usted ha ingresado {edad} años")
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement