The lamp is OFF. It stays dark!

Gate by gate
- A OR B → OFF OR ON = ON
- NOT (A OR B) → NOT ON = OFF
- NOT D → NOT ON = OFF
- C OR NOT D → OFF OR OFF = OFF
- NOT (A OR B) AND (C OR NOT D) → OFF AND OFF = OFF
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 = False
D = True
lamp = not (A or B) and (C or not D)
print("Is the lamp on?", lamp)
When you run it, it prints:
Is the lamp on? False
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?