+ 1
[Solved] Test case 4 failure in Boolean logic 2
I've been thinking about what a person would input something that would make test case 4 fail. Here is my code, I've tried using or, specifying the else statement, and thinking about if they put a letter in, would it go through? Please, help if possible hour = int(input()) day = int(input()) # your code goes here if(day==1): if(hour>=10 and hour<=21): print('Open') elif(day==2): if(hour>=10 and hour<=21): print('Open') elif(day==3): if(hour>=10 and hour<=21): print('Open') elif(day==4): if(hour>=10 and hour<=21): print('Open') elif(day==5): if(hour>=10 and hour<=21): print('Open') else: print('Closed')
6 Antworten
+ 1
I think you need else part as closed for inner if part..
Like if input => 1 23 output need: closed.
I don't know problem description so guessing.. If it not work then pls add description...
Hope it help..
+ 4
I already found out how it works in all cases.
hour = int(input())
day = int(input())
# your code goes here
if (hour >= 10 and hour <= 21) and (day >= 1 and day <=5):
print ("Open")
else:
print ("Closed")
+ 2
I have this same problem.Test case 4 failed. My code is:
hour = int(input())
day = int(input())
if (hour <= 21 and hour >= 10):
if (day <= 5 and day >= 1):
print("Open")
else:
print("Closed")
0
Jayakrishna🇮🇳 yes it worked
0
Please help I have facing same problem test case 4 failed.Help
0
hour = int(input())
day = int(input())
# your code goes here
if hour >= 10 and hour <=21 and day <= 5:
print("Open")
else:
print("Closed")