lundi 27 juillet 2020

"NameError: name 'day_time' is not defined" error in Python3.8

user_day = input("What's the time? ")

if user_day >= 20 and user_day <= 24:
    day_time = "Night"

elif user_day >= 24 and user_day <= 12:
    day_time = "Morning"

elif user_day >= 12 and user_day >= 17:
    day_time = "Noon"

elif user_day >= 17 and user_day >= 20:
    day_time = "Evening"

I am making a program which tells the part of the day by the time entered.
But I am getting this error:

if day_time == 1 and user_weather == plus:
NameError: name 'day_time' is not defined

Please help me out

Aucun commentaire:

Enregistrer un commentaire