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

Could someone please complete this code for me so I can get a better understanding of this

Not understanding this one bit

membership.py
store_open = None
store_hours = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18]
time = 10
if time in store_hours:

1 Answer

Name:GoogleSearch orJonathan Sum
Name:GoogleSearch orJonathan Sum
5,039 Points

You are going to have confuse about two var ,which are None and time, those i am going to use'

store_open = None  #You have to set the store_open to None because this var can be True or False based on the store opened or not.
store_hours = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18]
if time in store_hours: #i know the var"time" is undefined to you ,but u will understand it. Let's say var time is the hour in the store_hours list ,or let's call the var time is any integer in the store_hours list.
    store_open=True #This "if statement" menas if time in the store_hours list ,the store_open assign to True.
else: 
    store_open =False # else,which is just like english grammer ,means if "if statement" fails ,which the var time(hour) is not not in the store_hours list ,the store_open assign to False.