PythonでThe Hamming Distance

f:id:g_YUYUYU:20140428222824p:plain

コード

def checkio(n, m):

	num3 = format(n ^ m,"b").count("1")
	print num3

if __name__ == '__main__':
	checkio(117, 17)
	checkio(1, 2)
	checkio(16, 15)