Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # *******************************************
- # Segundo Parcial Práctico - Ejercicio 2
- # Fecha: 5/11/19
- # Autor: Lic. Diego Krauthamer
- # Descripción: Adivinar un nro
- # *******************************************
- #Declaración de constantes
- NROMAGICO=33
- MAXINTENTOS=3
- #Declaración de variables
- nro=-1
- ciclo=1
- #Cuerpo principal del programa
- while ciclo <=3:
- #Inicializacion de variables
- nro=-1
- #Ingreso de datos y validacion
- while nro <0 or nro >41:
- print("Ingrese un número entre 0 y 41:")
- nro=int(input())
- #Mensaje de error
- if nro <0 or nro >41:
- print("ERROR- Por favor Ingrese un número entre 0 y 41:")
- #Determino si adivino el nro
- if nro==NROMAGICO:
- print("!!!!Felicitaciones Adivino el NRO!!!!")
- else:
- print("No adivino, le quedan ",MAXINTENTOS-ciclo," intentos")
- #Incremento el contador
- ciclo=ciclo +1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement