Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Basics (2015) Logic in Python Membership

none

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.

who can solve this challenge task please involving none? its in python basics , after tthe topic containment

membership.py
time = 15

store_open = None
store_hours = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18]
if time in store_hours:
Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

uba chukwudire

When posting to the Community, please provide a descriptive title and then an explanation of the problem you are encountering, then any code that is relevant.

I have deleted some of your other posts that are either gibberish or just a single letter for a title and a single letter for a description... this is not acceptable posting behavior in the Community.

If you no longer need help from the Community for a specific post, then you may edit the Title only to include the word "Solved" at the beginning, so others know you have it figured out.

Thank you for your cooperation.

Jason ~ Treehouse Community Moderator

3 Answers

Antonio De Rose
Antonio De Rose
20,885 Points

the way you have started is perfectly correct. in the next line make it as below

store_open = True#make sure, this line is indented from the 1 above
       else:
store_open = False
Antonio De Rose
Antonio De Rose
20,885 Points

Hi Eric,

It clearly, states it is an indentation error, are you sure, is that the right indentation for the else, the issue is in the else line, try solve it.

Thanks,

Anton

Eric Ward
Eric Ward
4,198 Points

Ah I was actually basing it of where you indented the 'else:' in your code, as seen above, which has else indented in. I fixed it though. Thanks!

time = 15

store_open = None store_hours = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18]

if store_open is True if time is in store_hours:

elif store_hours is False:

I need help asap same question