Ask Your Question

Revision history [back]

You can also use Bitset.

sage: B = Bitset('0110101')
sage: C = Bitset('0' * B.capacity())
sage: for i in range(B.capacity()):
....:     C.add(i)
....:     print(B.symmetric_difference(C))
....:     C.discard(i)
1110101
0010101
0100101
0111101
0110001
0110111
0110100