bitwise scripts fixed

This commit is contained in:
Mari Wahl 2015-01-06 21:55:53 -05:00
parent 01703751f1
commit 91825867f6
25 changed files with 96 additions and 335 deletions

View file

@ -8,6 +8,10 @@ __author__ = "bt3"
def swap_bit(a, b):
'''
>>> swap_bit(14, 73)
(73, 14)
'''
a = a^b
b = a^b
a = a^b
@ -15,7 +19,5 @@ def swap_bit(a, b):
if __name__ == '__main__':
a = 14
b = 73
a2, b2 = swap_bit(a, b)
print "a was {0}, now it is {1}. \nb was {2}, now it is {3}".format(a, a2, b, b2)
import doctest
doctest.testmod()