teslariu

fd

Jul 17th, 2021
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Programa que pide una edad y decide la condiciòn frente al voto
  5.  
  6. # 1 condicional (if) y 2 bucles (while, for)
  7.  
  8. while True:
  9.    
  10.     #######################################
  11.     edad = int(input("Ingrese su edad: "))
  12.  
  13.     if 0 < edad < 16:
  14.         print("Voto prohibido")
  15.  
  16.     elif 16<= edad < 18  or edad >= 70:
  17.         print("Voto optativo")
  18.  
  19.     elif 18 <= edad < 70:
  20.         print("Voto obligatorio")
  21.    
  22.     else:
  23.         print("Error en el ingreso de la edad")
  24.    
  25.     ###########################################
  26.    
  27.     opcion = input("Presione cualquier tecla para continuar (o 1 para salir): ")
  28.     if opcion == "1":
  29.         print("Gracias por usar este programa...")
  30.         break
Advertisement
Add Comment
Please, Sign In to add comment