+ 2
Can you solve this?
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
13 Antworten
+ 7
You are only using the variable 'day'. What about 'hour'?
+ 6
Read the task carefully.
"The store is open on all days from 10 to 21, except Sunday and Saturday"
It means it's opened for 11hours (10-21) in a day and 5 days in a week.
Hope you know there are 7 days in a week. day ==13 or day == 20 isn't valid condition
You need to create a code to check these two conditions :)
+ 2
hour = int(input())
day = int(input())
# your code goes here
if (day==6 or day==7):
print("Closed")
elif ((day!=6 or day!=7) and (hour>=10 and hour<=21)):
print("Open")
else:
print("Closed")
I got the answer of my question thanks to all.
+ 1
There are 6 cases 5 cases runing but 1 case is wrong and that case is locked is anyone faced this question? Please help me
0
hour = int(input())
day = int(input())
# your code goes here
if (day==13 or day==14):
print("Closed")
elif (day==20 or day==21):
print("Closed")
elif (day==6 or day==7):
print("Closed")
else:
print("Open")
0
Store is open for 24 hours so i didn't put hours
0
Yes but 1 case is not running out of 6 thats the problem and I don't know what's that case because it is locked case.
0
Yes i got it thank u for comment and help sir
0
If monday to friday AND 10 o clock to 21 o clock , then store open
Saterday and sunday closed, store closed
0
I guess 10 to 21 are hrs in a 24hr clock ,not the days! As they already mention week has only 7 days and that s from 0 to 7
https://code.sololearn.com/cA2TKbAvr8px/?ref=app
It has to look something like this
0
Define required variable with associated time of the day