0
Cane someone help me solve this and explain please, thank you.( i want store_open = None to change to True
time = 15 store_open = None store_hours = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18] if time == store_hours: print(store_open == True) else: print(store_open == False)
4 odpowiedzi
+ 9
Oh yeah, right. Sorry, I'm not good at Python syntax. If you look at my codes, they're all in C++ ><
+ 8
// You should be using assignment operator (=) instead of equality (==).
time = 15
store_open = None
store_hours = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18]
if time == store_hours:
store_open = True
print(store_open)
else:
store_open = False
print(store_open)
+ 6
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
print(store_open)
#For checking list use 'in' instead of '=='
+ 1
thank you, it did work for me but with
if time in store_hours: and everything else stayed the same.