Parity will store the count of set bits
parity = 0 NEW_LINE while x != 0 : NEW_LINE INDENT if ( x & 1 ) : NEW_LINE INDENT parity = parity + 1 ; NEW_LINE DEDENT x = x >> 1 NEW_LINE DEDENT if ( parity % 2 == 0 ) : NEW_LINE INDENT return True NEW_LINE DEDENT else : NEW_LINE INDENT return False NEW_LINE DEDENT