12 lines
346 B
Python
12 lines
346 B
Python
def distance(strand_a, strand_b):
|
|
length_sum = len(strand_a) - len(strand_b)
|
|
if (strand_a == strand_b):
|
|
return 0
|
|
if (length_sum != 0):
|
|
raise ValueError("Not the same distance")
|
|
distance = 0
|
|
for i, letter in enumerate(strand_a):
|
|
if (letter != strand_b[i]):
|
|
distance += 1
|
|
return distance
|