I want to make a program that asks your age then from there tells you whether you can drive or not. I want it to re-ask the question if the user inputs a letter or symbol instead of a number.
Input:
J
Error:
Python "Programs\welcome.py", line 3, in <module>
age = str(input("How old are you?: "))
File "<string>", line 1, in <module>
NameError: name 'J' is not defined
Code:
while True:
age = str(input("How old are you?: "))
if int(age) > 15 and age.isdigit:
print ("Congradulations you can drive!")
elif int(age) < 16 and age.isdigit:
print ("Sorry you can not drive yet :(")
else:
print ("Enter a valid number")