Learning Scientific Programming with Python (2nd edition)
P2.4.2: The Hamming distance between strings
Question P2.4.2
The Hamming distance between two equal-length strings is the number of positions at which the characters are different. Write a Python routine to calculate the Hamming distance between two strings, s1
and s2
.