I dont know what to do


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

The code I have doesn't work but why?


What error do you get? For me it works.


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)


I just had to refresh