XOR gate in Python