Question
Instructions Good day! Bonjour! Good evening! Bonsoir! You are in a bilingual country! A nice thing to know is how to greet people in any
Instructions
Good day! Bonjour! Good evening! Bonsoir!
You are in a bilingual country! A nice thing to know is how to greet people in any language. You are going to write a program to make sure that we know how to greet the people around us. The French word Bonjour means "Good day". This is greeting can be used from morning until dusk (lets 18:00 or 6pm). After dusk we might say Bonsoir or "Good evening". Lets make a program that lets us know what is most appropriate to say based on the time of day. We will use the 24-hour clock (which runs from 0:00 to 23:59) to make it easier.
If the time is before 17:00, we will output
Good day! Bonjour!
Otherwise, the program will output
Good evening! Bonsoir!
Details of your program are defined below. Hint: We learned about if/else statements in class this week!
Details
Input
The program takes in the following input:
- hour: an integer, from 0 to 23, representing the hour of the day (in 24-hour time)
- minutes: an integer representing the minutes after that hour (from 0 to 59)
(You will notice that the program already outputs this time so that you can see more details about the test cases.)
Processing
Check whether the time is before or after 17:00.
Output
- If the time is before 17:00, the program will output "Good day!" on one line, followed by Bonjour! on the next.
- Otherwise, the program will output Good evening on one line followed Bonsoir!
Sample input/output:
Input | Output |
7:15 | 7:15 Good day! Bonjour! |
13:43 | 13:43 Good day! Bonjour! |
19:57 | 19:57 Good evening! Bonsoir! |
23:56 | 23:56 Good evening! Bonsoir! |
Full Screen pod4.py New 3 # Week 4, POD 4 4 # @author: Angela Siegel 6 # Read in input 7 time = input() #e.g. "7:15" or 12:34", 9 hour = int(time[0:time. find(":")]) # holds the hour as an int, 10 minutes = int(time[-2:]) # holds the minutes as an int 11 12 print(time) 13 14 15 # PLEASE START YOUR WORK HERE # #=========
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started