Question #290648

Use an if.. else statement and write a program that asks the user for input of the time in hours (1 to 24) for the day. if the time value is greater than 6 and less than 18, then the program must output a comment. 'Have a Happy Day', else the comment must be 'Rest Well' please bane the program and provide at least one code comment

Expert's answer

def main():
    hour = int(input()) #input of time
    if hour >= 6 and hour <= 18: #it's like 6<=hour<=18
        print("Have a Happy Day")
    else:
        print("Rest Well")

if __name__=="__main__": #program entry point
    main()

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS