Just started learning Python yesterday. Trying to write a simple script that asks the user questions. I am trying to limit the range of the "birth_year" by introducing certain constraints but I am not able to repeat the question if the user keys in an invalid answer.
import datetime
now = datetime.datetime.now()
birth_year = (input('What is your birth year? '))
while not birth_year.isdigit():
birth_year = (input("Error. Please input an integer: "))
if int(birth_year) > int(now.year):
print("Don't mess with me.")
if int(birth_year) < 0:
print("No negative numbers please!")