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

python basics membership challenge task 1 of 1

I just cannot get this to work..... Someone please tell me what I'm doing wrong.

membership.py
time = 15

store_open = [14, 15, 16, 17, 18]
store_hours = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18]
if time in store_open:
    True
else:
    False

9 Answers

Almost ...

The store_open is a boolean type variable that you want to set to be True or False. You just need to assign store_open to the True or False value.

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

ok, thanks

now the thing says: 'store_open' is not true

Can you post the code you tried which resulted in that error?

all i did was change what you told me to change

Ok but just to make sure there's no other typos in what you submitted, please post the code you tried.

Otherwise, just copy/paste my code snippet and try it directly.

(e.g. In your solution, did you use store_open = None, because in your original code snippet, it is store_open = [14, 15, 16, 17, 18], which shouldn't be the case.)

time = 15

store_open = [14, 15, 16, 17, 18] store_hours = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18] if time in store_open: store_open = True else: store_open = False

Ok, you need to use store_open = None instead of store_open = [14, 15, 16, 17, 18].

ok

the outcome didn't change

try refreshing your browser page, then copy/paste my solution above directly, or type it in exactly

ok

THANK YOU SO MUCH!

You're welcome! :-)