I have two binary strings (not integer) for example 0101
and 0010
, I need to XOR these two binary strings and then XOR the each bit of the result again. XOR of these two results in 0111
, now I want to achieve the result 0 xor 1 xor 1 xor 1
. How can I achieve it in python?
I have XORed the two strings in result variable, now I need to find the XOR of each bit in result
a = "0101"
b = "0010"
result = []
for x, y in zip(a, b):
if x == y:
result.append('0')
else:
result.append('1')
final = []