Is the Shop Open?
Python
25 pts
Is the Shop Open?
A shop in Massawa is open from Monday to Saturday, from 8 to 18 o’clock (8 <= hour < 18), but it closes for lunch from 12 to 14 (12 <= hour < 14). Customers can use the phone line when it is Sunday or lunch time.
Create these booleans:
work_day— the day is not"Sunday".in_hours— the hour is between 8 and 18.lunch_break— the hour is between 12 and 14.is_open—work_dayandin_hoursand notlunch_break.use_phone— the day is"Sunday"orlunch_break.
Print as shown. Expected output with the given data:
Open: False Phone line: True
Checklist
- Keep
dayandhourunchanged and creatework_day: the day is not Sunday. - Create
in_hoursandlunch_breakwith chained comparisons. - Create
is_openfromwork_day,in_hoursandlunch_break. - Create
use_phone: the day is Sunday or it is lunch time. - Print the two lines as shown.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
