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.pythonPath": "python/venv/bin/python3",
|
||||||
"python.terminal.activateEnvInCurrentTerminal": true,
|
"python.terminal.activateEnvInCurrentTerminal": true,
|
||||||
"python.testing.pytestArgs": ["python"],
|
|
||||||
"python.testing.unittestEnabled": false,
|
"python.testing.unittestEnabled": false,
|
||||||
"python.testing.pytestEnabled": true,
|
"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):
|
def distance(strand_a, strand_b):
|
||||||
strand_a_length = strand_a.length()
|
length_sum = len(strand_a) - len(strand_b)
|
||||||
strand_b_length = strand_b.length()
|
if (strand_a == strand_b):
|
||||||
|
return 0
|
||||||
print(strand_a_length)
|
if (length_sum != 0):
|
||||||
pass
|
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 unittest
|
||||||
|
import pytest
|
||||||
|
|
||||||
from hamming import (
|
from hamming import (
|
||||||
distance,
|
distance,
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
pytest
|
||||||
|
pep8
|
||||||
|
pylint
|
Loading…
Reference in New Issue