Python Python Basics (2015) Logic in Python Membership

What is wrong with this?

What is wrong with 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

2 Answers

Steven Parker
Steven Parker
173,537 Points

The indentation of an "else" should be the same as the "if" that it goes with (they should line up vertically).

Also, the word "else" should be followed by a colon (":").

Thanks again so helpful.