Guys im struggling this boolean exercise | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Guys im struggling this boolean exercise

You need to create a program that outputs whether a store is Open or Closed, based on the hour and the day of the week. The store is open on all days from 10 to 21, except Saturday and Sunday. You need to take the hour and the day of the week as input. The day of the week is represented as an integer (1 for Monday, 2 for Tuesday, etc.) Sample Input: 15 4 Sample Output: Open

13th May 2021, 9:24 PM
Lungisani
Lungisani - avatar
4 Answers
0
hour = int(input()) day = int(input()) # your code goes here if hour < 10 and day < 6: print ("closed") elif hour > 21 and day < 6: print ("closed") elif hour > 10 and day < 6: print ("open")
13th May 2021, 9:31 PM
Lungisani
Lungisani - avatar
0
Maybe u can better explain how im supposed to approach such a problem
13th May 2021, 9:32 PM
Lungisani
Lungisani - avatar
0
Thank you, this makes so much sense, any avice on how i can improve my problem solving approach ?
14th May 2021, 9:00 AM
Lungisani
Lungisani - avatar
0
Hi Mirielle i tried this code but still nothing, any idea where i might be getting it ol wrong ? hour = int(input()) day = int(input()) # your code goes here if (hour >= 10 and hour <=21): if (day >=1 and day <=5): print ("open") else: print ("closed")
17th May 2021, 8:03 AM
Lungisani
Lungisani - avatar