Python Python Basics (2015) Logic in Python Membership

Why does this not work?

I have tried every which way I can think of to make this work, but Treehouse still says it's wrong. Why is this?

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

Antonio De Rose
Antonio De Rose
20,855 Points
#pyhon heavily relies on indentation
#if else, like other languages use curly braces, python uses on indentation

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: #this is where the error is, and solely on indentation
    store_open = False

Thanks this helped me a lot!