Wilfried Allico2,310 Points
I need help please
See that time variable? That's what time it currently is, at least for this test. But, when you submit your code, the time might change! I need you to make an if condition that sets store_open to True if time is in the store_hours list. Otherwise, if time isn't in store_hours, set store_open to False. You'll probably have to use if, else, and in to solve this one.
I cannot seem to figure this one out.
time = 15 store_open = None store_hours = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18] if time in store_hours: store_opens = True else: store_opens = False
Your code is quite close, but there are two issues:
- The name of the variable representing the store being open is named store_open not store_opens like you have written in your code.
- The indentation (horizontal spacing) of your
elsestatement and of the code inside it is wrong. In Python indentation is used to group code together and is therefore vital to get right.
elsestatements have to be indented to be at the same level as the
ifstatement they are attached to.
If you fix those two issues like this:
time = 15 store_open = None store_hours = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18] if time in store_hours: store_open = True else: store_open = False
Then your code will pass.
Only thing my untrained eye see's is that you added a plural to your store_open list take off the 's' and you should be a bit closer to your goal.