# swap two variables without intermediate variable, but intermediate variable is applicable to various situations(even with complex objects)标签:10b,variables,two,without,intermediate,variable From: https://www.cnblogs.com/dissipate/p/16871855.html
# the two methods below only applicable to numerics
# solution 1
a = 10
b = 8
a = a + b
b = a - b
a = a - b
print(f'{a=!r}\t{b=!r}')
# solution 2 exclusive OR
a = 10
b = 8
a = a ^ b # hold info about different bits of the two numbers
b = a ^ b
a = a ^ b
print(f'{a=!r}\t{b=!r}')