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

i dont understand how to assign a value to store_open = none

i understand the logic of 'if' and 'in' and i also understand strings and lists - but i dont understand the 'none' item in store_open = none, and then change that to true or false. pretty sure its something simple. could someone check my code. sorry - beginner here!

membership.py
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]

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You're doing great, and yes, you clearly understand the logic. At some point, though, it seems you might have missed something about what is known as "built-in constants". There are a few of these in Python and they are documented here

The None constant represents the absence of a value. Most programming languages have a similar thing although it can be named differently across languages. The same goes for True and False. These are reserved words (when capitalized in precisely this manner) in Python.

Here's an example:

treehouse_student = True

I think you can get it with this hint but let me know if you're still stuck! :sparkles:

thank you! makes complete sense now