Advertisement
tdrobotica

Reto 3 curso de Python

Mar 9th, 2022
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | None | 0 0
  1. import random
  2. numero = random.randint(1,11)
  3. intentos = 0
  4. jugando = True
  5. print("Bienvenido al juego, ¡adivina el número!")
  6. while(jugando):
  7.     intentos += 1
  8.     if (intentos<=5):
  9.         eleccion = int(input("Dime un numero: "))
  10.         if (eleccion == numero):
  11.             print("Adivinaste, felicitaciones")
  12.             jugando = False
  13.         elif eleccion > numero:
  14.             print("El numero es muy alto, este es tu intento número ",intentos)
  15.         elif eleccion < numero:
  16.             print("El numero es muy bajo, estas en tu intento número ",intentos)
  17.     else:
  18.         print("Has realizado todos tus intentos, gracias por jugar.")
  19.         jugando = False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement