# Task
 The `hamming distance` between a pair of numbers is the number of binary bits that differ in their binary notation. 
 
# Example

 For `a = 25, b= 87`, the result should be `4`
```
25: 00011001
87: 01010111
```
The `hamming distance` between these two would be 4 ( the `2nd, 5th, 6th, 7th` bit ).


# Input/Output


 - `[input]` integer `a`

  First Number. `1 <= a <= 2^20`


 - `[input]` integer `b`

  Second Number. `1 <= b <= 2^20`


 - `[output]` an integer

  Hamming Distance

Source: codewars | Difficulty: EASY
Tags: Ad-hoc

Starter code: def hamming_distance(a, b):
	

Solutions:
def hamming_distance(a, b):
	return bin(a ^ b).count('1')


from itertools import zip_longest

def hamming_distance(a, b):
	return sum((x != y for (x, y) in zip_longest(*[bin(x)[-1:1:-1] for x in (a, b)], fillvalue='0')))


def hamming_distance(a, b):
	return sum((int(i) for i in bin(a ^ b)[2:]))


def hamming_distance(a, b):
	return sum((x != y for (x, y) in zip(format(a, '020b'), format(b, '020b'))))


def hamming_distance(a, b):
	p = len(bin(max(a, b)))
	return sum((i != j for (i, j) in zip(bin(a)[2:].rjust(p, '0'), bin(b)[2:].rjust(p, '0'))))


hamming_distance = lambda a, b: bin(a ^ b).count('1')


def hamming_distance(a, b):
	(A, B) = ([], [])
	a1 = str(bin(a)[2:])
	print(a1)
	[A.append(i) for i in a1]
	b1 = str(bin(b)[2:])
	print(b1)
	[B.append(i) for i in b1]
	distance = 0
	print(A)
	if len(A) < len(B):
		zeros = ['0'] * (len(B) - len(A))
		A = zeros + A
	elif len(A) > len(B):
		zeros = ['0'] * (len(A) - len(B))
		B = zeros + B
	else:
		pass
	print(A)
	for i in range(0, len(A)):
		if A[i] != B[i]:
			distance += 1
	return distance


def hamming_distance(a, b):
	c = ''
	d = ''
	c = bin(a)[2:]
	d = bin(b)[2:]
	for i in range(32 - len(c)):
		c = '0' + c
	for i in range(32 - len(d)):
		d = '0' + d
	count = 0
	for i in range(32):
		if c[i] != d[i]:
			count += 1
	return count


def hamming_distance(a, b):
	total = 0
	a = list(bin(a)[2:])
	b = list(bin(b)[2:])
	if len(a) > len(b):
		for i in range(len(a) - len(b)):
			b.insert(0, '0')
	elif len(b) > len(a):
		for i in range(len(b) - len(a)):
			a.insert(0, '0')
	for index in range(len(a)):
		if a[index] != b[index]:
			total += 1
	return total