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

Daniel Choban
Daniel Choban
6,173 Points

I seem to have followed the steps perfectly yet i am unable to pass to the next lesson Please HELP

I followed the steps to the letter, yet i keep getting an error message stating "store_open is not True"

membership.py
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
Ramiro Martinez
Ramiro Martinez
13,858 Points

This exercise tells you that you need to create a variable called time with the current hour, then in the if statement, you are going to look for the variable named time, not the string "time" in the list of store_hours.

time = 10
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

Chris Howell
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Chris Howell
Python Web Development Techdegree Graduate 49,702 Points

Read the first sentence of the challenge prompt again. It says:

I'm going to create a variable named time. It'll be an integer for the current hour (well, what I want the current hour to be).

So there is a variable called time that is already created for you to use. ( it doesnt show in the code, but its already there. Dont try to reset its value to something else). You are currently comparing the string time against the variable holding a list of values. This will always fail because the string never occurs in that list of integers.