Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for The Hamming Distance by Chocolater
def checkio(n, m):
result = 0
list1 = "{0:b}".format(n).zfill(20)
list2 = "{0:b}".format(m).zfill(20)
return sum(x != y for x, y in zip(list1, list2))
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert checkio(117, 17) == 3, "First example"
assert checkio(1, 2) == 2, "Second example"
assert checkio(16, 15) == 5, "Third example"
Nov. 2, 2016