def main():
# Firstly, we need to convert the result of input() for further processing
hours = int(input("Enter the time of the day (0-23): "))
# Now we need a if-elif staircase to select and print the answer
if 0 <= hours <= 12:
print("It's morning")
elif 13 <= hours <= 17:
print("It's afternoon")
elif 18 <= hours <= 19:
print("It's evening")
elif 20 <= hours <= 23:
print("It's night")
else:
print("It isn't an integer value between 0 and 23")
if __name__ == "__main__": # is the file is running as a script, not importing
main() # call the main() function
Comments
Leave a comment