This XOR That? 9/14


#1

print ^ 0b1110
print ^ 0b101

this was my feedback... File "python", line 1
print ^ 0b1110
^
SyntaxError: invalid syntax

I don't know how to do this one at all. PLEASE help!


#2

XOR is a binary operator, so you have to specify left and right operand.

Example: 1110^101.


In Python I would use this code:

print bin(int("1110", 2) ^ int("101", 2))

or:

print bin(0b1110 ^ 0b101)