def invert_bit(number, bit_position):mask = 1 << bit_positionreturn number ^ mask
number = 13bit_position = 2
print(f"Number before inverting bit: {number}")number = invert_bit(number, bit_position)print(f"Number after inverting bit: {number}")
def invert_bit(number, bit_position):
mask = 1 << bit_position
return number ^ mask
number = 13
bit_position = 2
print(f"Number before inverting bit: {number}")
number = invert_bit(number, bit_position)
print(f"Number after inverting bit: {number}")