0
What am I doing wrong?
hour = int(input()) day = int(input()) if hour >= 10 and hour <= 21: if day > 0 and day < 6: print("Open") else: if hour < 10 or hour > 21: if day == 6 or day == 7: print("Closed")
8 ответов
+ 1
# hour should be between 10 <= and <= 21, to write both condition at once:
hour = int(input())
day = int(input())
if day < 6 and 10 <= hour <=21:
print("Open")
else:
print("Closed")
+ 1
Hi! You not pass test #3, where hour - 13, day - 6 -> no output. Can you solve this?
+ 1
First problem.
Your range of days goes from 0 to 7 inclusive, which is eight days.
Tidy up your if / else statement.
you know that the end result is open or closed, so specify the opening hours only.
when your if statement is not true (open), the else statement will commence.
So if not open _> else: print("closed")
+ 1
days can start with both zero and one inclusive, this does not affect anything, because 0 and below will never be entered.
+ 1
explanations in comments, and other shortest ways to write it...
https://code.sololearn.com/cnBG5pNVaZjR/?ref=app
+ 1
Thankyou everyone for the help and in-depth explinations
0
After I cut out the closed hours it works on everything other that input 13 & 6
0
hour = int(input())
day = int(input())
if day < 6 and hour >= 10 <=21:
print("Open")
else:
print("Closed")
Won't clear test 4. Ugh.. do they lock some of the tests performed on it to make you do bug evaluations?