I wanted to create a little game with the random.randit function. In this game, you have to guess a number (nombre_secret)with a number (nb) but when I run it i can't choose an answer. Can someone help me ?
import random
nombre_secret = random.randint(1,10)
nb = int (input("Guess the number:"))
while nb != nombre_secret:
if nb < nombre_secret:
print: ("bigger!")
elif nb > nombre_secret:
print: ("smaller!")
elif nb == nombre_secret:
print: ("You Win!")
nb = input("try another one:")
Aucun commentaire:
Enregistrer un commentaire