Guesses = 0
while(Guesses < 101):
try:
x = int(input("6 divided by 2 is: "))
if(x == 3):
print("Correct! 6 divide by 2 is", x)
break
else:
print("Incorrect. try again")
Guesses += 1
except ValueError:
print("That is not a number. Try again.")
Guesses += 1
else:
print("Out of guesses.")
, , input a number, while\else loop, try\except loop. try\except , , inputs , ValueError, , inputted was not a number. while\else loop , , Guesses 100. , guesses the answer, 3, they got the answer right and the loop will end; -, 3 (), answer will be incorrect will be prompted the question again; user guesses a string ValueError, , their answer wasn't a number and that the user has to try again.
, , , , , , , . :)