+ 7

Hi, Why everything is "Open"?

I tried all options but it can't. https://code.sololearn.com/caG787r9YzEM/?ref=app

30th Apr 2021, 7:44 AM
Egor Tonchev(EGO)
Egor Tonchev(EGO) - avatar
9 odpowiedzi
+ 8
Thanks for all -)
30th Apr 2021, 9:36 AM
Egor Tonchev(EGO)
Egor Tonchev(EGO) - avatar
+ 6
I removed it but when I input 11, 6 the output is Open instead of "Closed".
30th Apr 2021, 8:09 AM
Egor Tonchev(EGO)
Egor Tonchev(EGO) - avatar
+ 6
So, what I've to do?
30th Apr 2021, 9:28 AM
Egor Tonchev(EGO)
Egor Tonchev(EGO) - avatar
+ 4
Egor Tonchev(EGO) Problem is with day. It should be integer
30th Apr 2021, 9:30 AM
A͢J
A͢J - avatar
+ 2
In order for the store to be Open, the hour must be in the range 10-21 and the day must be less than 6. Otherwise, the store is Closed. You can express the hour being in the range a few ways; 10 <= hour <= 21 hour >= 10 and hour <= 21 hour in range(10, 22) All you should need is an if-else statement here. Check the hour in one of the ways above then also check to see that it is not the weekend by 'and day < 6' Something like; if (10 <= hour <= 21) and day < 6: ... else: ...
30th Apr 2021, 9:06 AM
ChaoticDawg
ChaoticDawg - avatar
+ 2
Egor Tonchev(EGO) Nothing your code is right. I have got all test cases passed.
30th Apr 2021, 9:29 AM
A͢J
A͢J - avatar
+ 2
Egor Tonchev(EGO) Yes, now that you've made those changes, all you need to do is make sure that the input() for day is converted to an int() like the hour is.
30th Apr 2021, 9:34 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
hour cant be less than or equal to 10 AND greater than or equal to 21
30th Apr 2021, 7:50 AM
Slick
Slick - avatar
+ 1
Thats because of the elif statement. It says that if the hour is greater than/equal 10 and less than/equal to 21, then print "Open". Wich it does
30th Apr 2021, 8:31 AM
Slick
Slick - avatar