Python Python Basics (2015) Logic in Python Membership

Oscar Chong
PRO
Oscar Chong
Pro Student 292 Points

What's wrong with my code? pls help

Pls help. Thankssss

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

Jason Anders
MOD
Jason Anders
Treehouse Moderator 144,810 Points

Hi Oscar,

You're on the right track, but you want to assign the values of True or False not compare them to the variable. Remember a single = is an assignment operator but a double == is a comparison operator.

Just fix that up and the rest looks good.
Nice job!

Keep Coding! :) :dizzy:

Oscar Chong
Oscar Chong
Pro Student 292 Points

Thanks Jason. You are very nice.