13/14 cant figure out plz help!


#1

fourth_bit = some_data & 0b1000
a = 0b11101110
mask = 0b11111111
print bin(a ^ mask)


#2

get rid of the
fourth_bit = some_data & 0b1000
and it should work


#3

Yes, this works, thanks kyle617! :relaxed:

They should be split between the last "0" and "mask" variable as well as the "1" and the "print" command.


#4

Worked for me.. just make sure its 8 bits and not 7 or 9... too many ones or too little can be a challenge... lol...

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