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 trialMaggie Wolff
495 Pointspython basics membership challenge task 1 of 1
I just cannot get this to work..... Someone please tell me what I'm doing wrong.
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
35,864 PointsAlmost ...
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
495 Pointsok, thanks
Maggie Wolff
495 Pointsnow the thing says: 'store_open' is not true
David Lin
35,864 PointsCan you post the code you tried which resulted in that error?
Maggie Wolff
495 Pointsall i did was change what you told me to change
David Lin
35,864 PointsOk 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
495 Pointstime = 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
35,864 PointsOk, you need to use store_open = None instead of store_open = [14, 15, 16, 17, 18].
Maggie Wolff
495 Pointsthe outcome didn't change
David Lin
35,864 Pointstry refreshing your browser page, then copy/paste my solution above directly, or type it in exactly
Maggie Wolff
495 PointsTHANK YOU SO MUCH!
David Lin
35,864 PointsYou're welcome! :-)