Just flip out


#1

https://www.codecademy.com/courses/python-intermediate-en-KE1UJ/2/3?curriculum_id=4f89dab3d788890003000096
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.


#2

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


#3

how is a mask supposed to look for XOR


#5

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.


#6

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


#7

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