[Solved] Test case 4 failure in Boolean logic 2 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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')

25th Oct 2020, 2:48 PM
Serana Zentha
Serana Zentha - avatar
6 Answers
+ 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..
25th Oct 2020, 4:13 PM
Jayakrishna 🇮🇳
+ 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")
17th Mar 2021, 4:30 AM
Carlos Guzman
Carlos Guzman - avatar
+ 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")
28th Jul 2021, 9:55 AM
Aesherian PS4
Aesherian PS4 - avatar
0
Jayakrishna🇮🇳 yes it worked
27th Oct 2020, 6:22 PM
Serana Zentha
Serana Zentha - avatar
0
Please help I have facing same problem test case 4 failed.Help
4th Jan 2021, 8:28 PM
Priyankar Ghosh
Priyankar Ghosh - avatar
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")
1st Mar 2022, 4:19 PM
Rob K