python - Why is it keep on asking when I input correctly? -
def main(): month = 0 date = 0 year = 0 date = [month, date, year] user = input("enter according mm/dd/yy:") user = user.split('/') month = user[0] date = user[1] year = user[2] while int(month) > 12 or int(month) < 1 : print("month incorrect.") user = input("enter according mm/dd/yy:") while int(date) > 31 or int(date) < 0: print("date incorrect.") user = input("enter according mm/dd/yy:") while int(year) > 15 or int(year) < 15: print("year incorrect.") user = input("enter according mm/dd/yy:")
i keep on getting month incorrect when it's correct. please help. i'm trying user's input match correct form of mm/dd/yy. , i'm trying convert yy -> 2015. please help.
there bug in code. suppose if input "15/30/15", says incorrect month , tries fetch user input in format "mm/dd/yy", user not spliting based on '\', while loop keeps running till user[0] assigned new month. error occurs incorrect date , year well. fix call user input function , split user inside while loop itself.