Булева логика | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Булева логика

Помогите пожалуйста, никак не могу понять почему не работает https://sololearn.com/coach/123/?ref=app hour = int(input()) day = int(input()) if hour >=10 and hour <=21 or day >=1 and day <=5: print("Open") else: print("Closed")

17th Jan 2021, 7:42 PM
Рамин Барциц
Рамин Барциц - avatar
8 Answers
+ 2
Рамин Барциц Solved (see below code ) You need and operator in between because both hours and day condition should be followed according to your question. Then you have to print closed/open : ) hour = int(input()) day = int(input()) if (10 <= hour <= 21) and (1 <= day <= 5): print("Open") else: print("Closed")
17th Jan 2021, 8:44 PM
Mr. Rahul
Mr. Rahul - avatar
+ 2
Рамин Барциц Try This hour = int(input()) day = int(input()) if (hour >=10 and hour <=21) or (day >=1 and day <=5): print("Open") else: print("Closed") Tell me if it works : ) bcz i can't see the question If u can plz post the question also : )
17th Jan 2021, 8:27 PM
Mr. Rahul
Mr. Rahul - avatar
+ 1
if hour <= 20 and day <= 5: print("Open") else: print("Closed")
8th Apr 2021, 12:41 AM
Артур Фурик
Артур Фурик - avatar
0
Unfortunately didn't work either;( You need to create a program that displays the state of the store Open or Closed depending on the time and day of the week. The store is open daily from 10 am to 9 pm, except Saturday and Sunday. You need to add the hour and day of the week as input. The day of the week is represented as an integer (1 for Monday, 2 for Tuesday, etc.)
17th Jan 2021, 8:31 PM
Рамин Барциц
Рамин Барциц - avatar
0
does not work when entering Saturday and Sunday (6-7 days)
17th Jan 2021, 8:33 PM
Рамин Барциц
Рамин Барциц - avatar
0
Brilliant! Thank you very much!!!
17th Jan 2021, 8:46 PM
Рамин Барциц
Рамин Барциц - avatar
0
Welcome Рамин Барциц Hope u learn from above code But i reccomend u to keep learning and try and try untill u didn't solve it by yourself
17th Jan 2021, 8:48 PM
Mr. Rahul
Mr. Rahul - avatar
0
of course!
17th Jan 2021, 8:49 PM
Рамин Барциц
Рамин Барциц - avatar