Just flip out


Here is my code:

a = 0b11101110
mask = 0b11101110
desired =  a ^ mask 
print bin(desired)

It throws the error Oops, try again. Make sure your answer is a binary string.


Your mask is incorrect. Take a look at truth table for XOR -> https://en.wikipedia.org/wiki/Exclusive_or#Truth_table


how is a mask supposed to look for XOR


You want to flip bits, right?

Take a look at the truth table (seriously) and solve this equation:

0 ^ x = 1
1 ^ x = 0

What is the value of x?

Mask should be 0bxxxxxxxx, change x to the solution of equation.


yes thank you. it had to be 0b11111111 :joy:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.