Mia Steinkirch a8e71c50db reorganize dir
Signed-off-by: Mia Steinkirch <mia.steinkirch@gmail.com>
2019-10-11 04:29:17 -07:00

23 lines
298 B
Python
Executable File

#!/usr/bin/env python
__author__ = "bt3"
'''
swapping values in place without extra memory
'''
def swap_bit(a, b):
'''
>>> swap_bit(14, 73)
(73, 14)
'''
a = a^b
b = a^b
a = a^b
return a, b
if __name__ == '__main__':
import doctest
doctest.testmod()