• The user will input the number in a 24-hour format. So, 14 means 2 pm, 3 means 3 am, 18 means 6 pm, etc. • Valid inputs are 0 to 23. Inputs less than 0 or more than 23 are invalid in 24-hour clock. · Assume, Input will be whole numbers. For example, 3.5 willI NOT be given as input. Inputs: Message to be printed 4 to 6: Breakfast 12 to 13: Lunch 16 to 17: Snacks 19 to 20: Dinner For all other valid inputs, say "Patience is a virtue" For all other invalid inputs, say "Wrong time" For example, If the user enters 4, your program should print the message "Breakfast". If the user enters 5, your program should print the message "Breakfast". If the user enters 6, your program should print the message "Breakfast". If the user enters 0, your program should print the message "Patience is a virtue". If the user enters 1, your program should print the message "Patience is a virtue". If the user enters 18, your program should print the message "Patience is a virtue". If the user enters 23, your program should print the message "Patience is a virtue". If the user enters 24, your program should print the message "Wrong Time". If the user enters -1, your program should print the message "Wrong Time". If the user enters 27, your program should print the message "Wrong time". Hints: You can use nested conditionals (if-else) or chained conditions (if-elif-else) to solve this problem.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Please show it in Python:

Take an hour from the user as input and tell it is time for which meal.
• The user will input the number in a 24-hour format. So, 14 means 2 pm, 3 means 3 am, 18 means 6 pm, etc.
• Valid inputs are 0 to 23. Inputs less than o or more than 23 are invalid in 24-hour clock.
• Assume, Input will be whole numbers. For example, 3.5 will NOT be given as input.
Inputs: Message to be printed
4 to 6: Breakfast
12 to 13: Lunch
16 to 17: Snacks
19 to 20: Dinner
For all other valid inputs, say "Patience is a virtue"
For all other invalid inputs, say "Wrong time"
For example,
If the user enters 4, your program should print the message "Breakfast".
If the user enters 5, your program should print the message "Breakfast".
If the user enters 6, your program should print the message "Breakfast".
If the user enters 0, your program should print the message "Patience is a virtue".
If the user enters 1, your program should print the message "Patience is a virtue".
If the user enters 18, your program should print the message "Patience is a virtue".
If the user enters 23, your program should print the message "Patience is a virtue".
If the user enters 24, your program should print the message "Wrong Time".
If the user enters -1, your program should print the message "Wrong Time".
If the user enters 27, your program should print the message "Wrong time".
Hints:
You can use nested conditionals (if-else) or chained conditions (if-elif-else) to solve this problem.
Transcribed Image Text:Take an hour from the user as input and tell it is time for which meal. • The user will input the number in a 24-hour format. So, 14 means 2 pm, 3 means 3 am, 18 means 6 pm, etc. • Valid inputs are 0 to 23. Inputs less than o or more than 23 are invalid in 24-hour clock. • Assume, Input will be whole numbers. For example, 3.5 will NOT be given as input. Inputs: Message to be printed 4 to 6: Breakfast 12 to 13: Lunch 16 to 17: Snacks 19 to 20: Dinner For all other valid inputs, say "Patience is a virtue" For all other invalid inputs, say "Wrong time" For example, If the user enters 4, your program should print the message "Breakfast". If the user enters 5, your program should print the message "Breakfast". If the user enters 6, your program should print the message "Breakfast". If the user enters 0, your program should print the message "Patience is a virtue". If the user enters 1, your program should print the message "Patience is a virtue". If the user enters 18, your program should print the message "Patience is a virtue". If the user enters 23, your program should print the message "Patience is a virtue". If the user enters 24, your program should print the message "Wrong Time". If the user enters -1, your program should print the message "Wrong Time". If the user enters 27, your program should print the message "Wrong time". Hints: You can use nested conditionals (if-else) or chained conditions (if-elif-else) to solve this problem.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY