I dont know what to do


#1

def flip_bit( number, n ):
mask = 0b1 << (n - 1)
result = (number ^ mask)
return bin(result)

The code I have doesn't work but why?


#3

What error do you get? For me it works.


#4

This code works for me. If you're still stuck then try this code.

def flip_bit(number,n):
     m=0b1 << (n-1)
     result = number ^ m
     return bin(result)

#5

I just had to refresh