For example I wanna input a random number and if it will be wrong then next input generate a new random number and so on..
Here is my code, but this is not what i want
import random
secret_number = random.randint(0, 10)
guess_count = 0
guess_limit = 20
while guess_count < guess_limit:
guess = int(input('Guess between [0, 10]: '))
guess_count += 1
if guess == secret_number:
print('You won!')
break
else:
print('Wrong..')
Aucun commentaire:
Enregistrer un commentaire