Skip to content

Instantly share code, notes, and snippets.

@viktorasm
Created October 13, 2015 07:31
Show Gist options
  • Save viktorasm/1af07985a91e3d757a01 to your computer and use it in GitHub Desktop.
Save viktorasm/1af07985a91e3d757a01 to your computer and use it in GitHub Desktop.
def hamming(s1,s2):
""" returns the hamming number (char differences) between two strings """
hamming_number = 0
for char1,char2 in itertools.izip_longest(s1,s2):
if char1!=char2:
hamming_number += 1
return hamming_number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment