I am getting warning for the last guess
in the last if
statement. Can I just ignore that and be sure, there is no case for my program to work incorrectly?
import random
print('Try to guess hidden number from 1 to 50, U have 6 tries by the way')
hidden_num = random.randint(1, 50)
tries = 6
while tries>0:
guess = int(input(f'Guess the hidden number, tries left: {tries}\n'))
tries-=1
if guess == hidden_num:
print('Great Job, You got it!')
break
elif guess < hidden_num:
print('U were so close, take a bit higher')
else:
print('WowWo! Pick lower,Dude!')
if guess != hidden_num and tries == 0:
print('Don\'t be upset buddy, you have whole life ahead!')
Aucun commentaire:
Enregistrer un commentaire