Python: hamming is added
This commit is contained in:
parent
5e8a3b70f0
commit
bbb95d8f0f
4 changed files with 124 additions and 0 deletions
6
python/hamming/hamming.py
Normal file
6
python/hamming/hamming.py
Normal 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)])
|
||||
Loading…
Add table
Add a link
Reference in a new issue