In my program I have asked the user some basic maths questions. But I don't want them to be able to type a letter. Is there a function or method out there that would allow me to create an error message and ask them to re-enter the answer.
Answer = int(input ("What is the answer to the question?"))
if Answer == Maths:
print ("Correct.")
Score += 1
#function/method to prevent them from entering letters:
print ("Please enter a valid answer.")
if Answer != Maths:
print ("Incorrect.")
Edit - I basically don't want them to enter a letter but in a way it doesn't crash.