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

Maggie Wolff
Maggie Wolff
495 Points

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

David Lin
David Lin
35,864 Points

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
Maggie Wolff
Maggie Wolff
495 Points

now the thing says: 'store_open' is not true

David Lin
David Lin
35,864 Points

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

Maggie Wolff
Maggie Wolff
495 Points

all i did was change what you told me to change

David Lin
David Lin
35,864 Points

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.)

Maggie Wolff
Maggie Wolff
495 Points

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

David Lin
David Lin
35,864 Points

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

Maggie Wolff
Maggie Wolff
495 Points

the outcome didn't change

David Lin
David Lin
35,864 Points

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

David Lin
David Lin
35,864 Points

You're welcome! :-)