Just Flip Out


#1



https://www.codecademy.com/courses/python-intermediate-en-KE1UJ/2/3?curriculum_id=4f89dab3d788890003000096#


I can't see why this isn't working. I'm getting, "Make sure your answer is a binary string."


I expect to be able to pass. It prints out all of the numbers in the 'On' position.


a = 0b11101110
mask = 0b00010001

result = a ^ mask

print bin(result)


#2

It looks like the mask is supposed to be 255, not 9. The result should be 17 instead of 231.

>>> 14 * 16 + 14
238
>>> 238 ^ 9
231
>>> bin(231)
'0b11100111'
>>> 238 ^ 255
17
>>> bin(17)
'0b10001'
>>>

#3

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