Bij het combineren van logische operatoren zijn haakjes belangrijk:
(a and b) or c is niet hetzelfde als a and (b or c)not(a or b) is niet hetzelfde als not(a) or not(b)not(a or b) is wel hetzelfde als not(a) and not(b)Gebruik haakjes om duidelijk aan te geven wat je bedoelt!
# inbraakalarm: gaat af als de hoofdschakelaar aan is én sensor A of B actief is
if algemene_knop and (sensorA or sensorB):
print("Alarm!")