I am new with "try" and "except" keyword in Python, today I learned it and tried to write a program that allows users to enter an integer, if they did not enter an integer, they will enter again. My idea is I will use the while loop with "try" and "except", but it seems like the while loop is not working in the situation.
error = False
while error == False:
try:
number = int(input("Enter a number: "))
error = True
except:
error = False
Is there anything that I missed? Thank you guys