Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- # 1 condicional (if-else) 2 bucles (while for)
- # Hacer un script que pida una edad y responda su condicion frente
- # al voto
- # menos de 16: voto prohibido
- # 16 cumplidos y menos de 18: voto optativo
- # 18 cumplidos y menos de 70: obligatorio
- # 70 cumplidos o más: optativo
- while True:
- #######################################################
- edad = int(input("Por favor, ingrese su edad: "))
- if 0 < edad < 16:
- print("Voto prohibido")
- elif 16 <= edad < 18 or edad >= 70:
- print("Voto optativo")
- elif 18 <= edad < 70:
- print("Voto obligatorio")
- else:
- print("Edad incorrecta")
- #######################################################
- opcion = input("Presione cualquier tecla para continuar (o '1' para salir): ")
- if opcion == "1":
- print("Gracias por usar este programa....")
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement