Answer to Question #290648 in Python for Kay

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

1
Expert's answer
2022-01-25T10:47:05-0500
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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS