Can someone explain what task 14 is asking to do!


Simply do not understand what it is asking for


Okay, here we go! :smile: The exercise asks you to:

  • Define a function called flip_bit that takes the inputs (number, n).
  • Flip the nth bit (with the ones bit being the first bit) and store it in result.
  • Return the result of calling bin(result).

This is a progression of exercise 13/14 where we flipped bits in a byte as well. In this case we're not asked to bit-flip the whole byte, but only one specific bit in the byte. What's more, we're asked to make a flexible function, where you can pass a parameter that says which specific bit to flip.

For example, if we wanted to flip the 3rd bit in 0b01110100, we would call flip_bit(0b01110100, 3). The resulting return value would be 0b01110000, with the third bit having gone from 1 to 0.

That's what they're asking you to build.