add a solution for the hamming problem
This commit is contained in:
parent
7967af4eb5
commit
9853c0ead4
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"python.pythonPath": "python/venv/bin/python3",
|
||||
"python.terminal.activateEnvInCurrentTerminal": true,
|
||||
"python.testing.pytestArgs": ["python"],
|
||||
"python.testing.unittestEnabled": false,
|
||||
"python.testing.pytestEnabled": true,
|
||||
"python.linting.enabled": true
|
||||
"python.linting.enabled": true,
|
||||
"python.testing.pytestArgs": ["python"]
|
||||
}
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
def distance(strand_a, strand_b):
|
||||
strand_a_length = strand_a.length()
|
||||
strand_b_length = strand_b.length()
|
||||
|
||||
print(strand_a_length)
|
||||
pass
|
||||
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
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import unittest
|
||||
import pytest
|
||||
|
||||
from hamming import (
|
||||
distance,
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
pytest
|
||||
pep8
|
||||
pylint
|
Loading…
Reference in New Issue