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 trialAlok Yadav
Courses Plus Student 445 PointsI need you to make an if condition that sets store_open to True if time is in the store_hours list. Otherwise, if time i
i am not getting right answer
time = 15
store_open = None
store_hours = [9, 10, 1;1, 12, 13, 14, 15, 16, 17, 18]
if time in store_hours:
store_open = True
else:
store_open = False
1 Answer
Jennifer Nordell
Treehouse TeacherHi there! Your logic is fine and your syntax is just fine, too. I had to look at this for a bit before I spotted it. Take a good look at the list in store_hours
. Somehow a runaway semicolon got into the list. The list should start with [9, 10, 11
, but yours starts with [9, 10 1;1
... If I remove the semicolon between the two 1s that should make up 11, your code passes with flying colors!
Hope this helps!