Created
October 13, 2015 07:31
-
-
Save viktorasm/1af07985a91e3d757a01 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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