trying to take a list of binary numbers, and display their 'opposites', im putting this word in quotes because I'm not sure if it's the best way to describe what I mean.
board=[1,10,101]
I want to make a function that will show the complement of opposite of these numbers like this:
newboard=[0,01,010]
basically swapping the 0 for a 1 and the 1 for a 0. Since they are integers I cant iterate through each binary number and manually change the value, I've tried using two's compliment but that doesn't semantically do what I'm trying to do it seems. Does anyone know a function for how to do this, or what this process would be called? thanks!
01integer either (that'd just be1). It looks ilke strings containing1and0characters would be a a better fit (at which point swapping characters is easy enough).0b101 ^ 0b111 == 0b010? But note that you'll see the decimal representation -5 ^ 7 == 2. You don't have0b101in your list, you have101.