0

Elif priblem python

hour = int(input()) day = int(input()) # your code goes here if hour >= 10 and hour <= 21: elif day != 6 or day != 7: print("Store is open") else: print("Store is close") Error...expecting an indented block...

5th Jun 2021, 2:23 AM
Mayank Hs
Mayank Hs - avatar
6 Antworten
+ 6
you doesn't put any statement after the first 'if' condition: that's where and what is expected ^^
5th Jun 2021, 2:26 AM
visph
visph - avatar
+ 1
You put the elif statement inside the if statement, making the IndentError to happen.
5th Jun 2021, 2:26 AM
Dino Wun (Use the search bar plz!)
Dino Wun (Use the search bar plz!) - avatar
+ 1
I guess you should do: if hour>=10 and hour<=21 and day!=6 and day!=7: ... else: ... notice the 'and' instead of 'or' between day condition ;)
5th Jun 2021, 2:29 AM
visph
visph - avatar
+ 1
Mayank See this article to know about "Indentation Error" in python https://www.educba.com/indentation-error-in-python/ You need to check like this: if(10 <= hour <= 21) and (day <= 5): #Open else: #Closed Why day <= 5? Because store opens only 5 days. And hours between 10 and 21 so we can check (10 <= hour <= 21) Also you have printed wrong value. There should be Open or Closed
5th Jun 2021, 8:42 AM
A͢J
A͢J - avatar
+ 1
Thank you all.
5th Jun 2021, 12:33 PM
Mayank Hs
Mayank Hs - avatar
0
hour = int(input()) day = int(input()) if hour >= 10 and hour <= 21: if day != 6 or day != 7: print("Store is open") else: print("Store is close") # here is your solution... Don't use elif in if conditional block, it will give syntax error..!! Also your code under conditional blocks was not indented properly...
5th Jun 2021, 8:52 AM
Lakshya Mittal
Lakshya Mittal - avatar