make the solution a bit cleaner
This commit is contained in:
parent
9853c0ead4
commit
294d39981b
|
@ -1,11 +1,12 @@
|
|||
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):
|
||||
if (len(strand_a) != len(strand_b)):
|
||||
raise ValueError("Not the same distance")
|
||||
|
||||
distance = 0
|
||||
for i, letter in enumerate(strand_a):
|
||||
if (letter != strand_b[i]):
|
||||
zipped_strands = zip(strand_a, strand_b)
|
||||
for a, b in zipped_strands:
|
||||
if (a != b):
|
||||
distance += 1
|
||||
return distance
|
||||
|
|
Loading…
Reference in New Issue