import random
winning_number = random.randint(1,100)
guess = 1
number = int(input("guess a number between 1 and 100: "))
while not game_over:
if number == winning_number:
print(f"you win, and you guessed this number in {guess} times ")
game_over = True
else:
if number < winning_number:
print("too low")
guess += 1
number = int(input("guess again: "))
else:
print("too high")
guess += 1
number = int(input("guess again: "))
I want to continue the guessing number until it reach the right answer.
Aucun commentaire:
Enregistrer un commentaire