how to calculate binary and 2c or 2c xor in python

Solutions on MaxInterview for how to calculate binary and 2c or 2c xor in python by the best coders in the world

showing results for - "how to calculate binary and 2c or 2c xor in python"
Sidney
15 Feb 2016
1>>> # this example swaps integers without a temporary variable using XOR
2>>> a = 2
3>>> b = 8
4>>> a ^= b
5>>> b ^= a
6>>> a ^= b
7>>> a
88
9>>> b
102
11