1
I would like the code not to break if the user puts a letter in place of a number in the variable: kick. This piece of code works very well if the user adds number, but if you add a letter, it’s gone! The code breaks.
Thank you very much from now on
chute = input("Escolha quantos chutes você pode dar! Escolha um numero entre 1 e 7")
if (int(chute) < 1 ):
print("XXX")
jogar()
elif (int(chute) > 7):
print("YYY")
jogar()
else:
print("Ok, você tem {} chutes" .format(chute))
I added another answer to the question Accept only numerics in input
– Juven_v