I am trying to use the bitwise not operator to flip the bits in 1.
I start with 1 (00000001) and add ~.
x = ~1
print(f'{x:08b}')
Result is -0000010.
Everything online tells me the result should be 11111110. Not sure what I can do wrong with putting ~ in front of a number.
I tried adding a step to make sure 1 shows up as 00000001, and it did:
a = 1
print(f'{a:08b}')
x = ~a
print(f'{x:08b}')
Really not sure how I can go wrong on this...