I found this strange if-statement in somebody else’s code:
if
if variable & 1 == 0:
I don\'t understand it. It should have two
This code just checks if the lowest bit of variable is a 0. Based on operator precedence this is:
variable
if (variable & 1) == 0:
First AND the lowest bit with one (extract just the lowest bit), then check if it is 0.