The lamp is ON. It lights up!

Gate by gate
- NOT B → NOT ON = OFF
- A OR NOT B → OFF OR OFF = OFF
- C OR D → ON OR OFF = ON
- (A OR NOT B) OR (C OR D) → OFF OR ON = ON
The same circuit in Python
Python has the same three gates built in: and, or and not. ON is True and OFF is False.
A = False
B = True
C = True
D = False
lamp = (A or not B) or (C or D)
print("Is the lamp on?", lamp)
When you run it, it prints:
Is the lamp on? True
Try it: change one of the switches from True to False (or the other way round) and run the code again. Can you find a switch that changes the lamp?