Exercise: Add elif block
The program below prints
It's evening
because hour is 14. However, 14 can hardly be considered evening. Add an elif
-statement to set the variable time_of_day to afternoon
when hour is more than 12 but less than 18.hour = 14
if hour < 12:
time_of_day = 'morning'
# add elif here...
else:
time_of_day = 'evening'
print("It's", time_of_day)
# expected output: It's afternoon
Python
Setting up Python environment...
Output