Python: hamming is added

This commit is contained in:
Dmitry Kokorin 2021-06-07 17:41:48 +03:00
parent 5e8a3b70f0
commit bbb95d8f0f
4 changed files with 124 additions and 0 deletions

View file

@ -0,0 +1,6 @@
def distance(strand_a, strand_b):
if len(strand_a) != len(strand_b):
raise ValueError("Strands must be of equal length")
return sum([a != b for a, b in zip(strand_a, strand_b)])