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
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()
Comments
Leave a comment