Skip to content
Snippets Groups Projects
Commit 92e65bcb authored by Julien David's avatar Julien David
Browse files

Merge branch 'pranavan_hamming' into 'master'

Pranavan hamming

See merge request !5
parents 95f4d53e 92700a29
No related branches found
No related tags found
1 merge request!5Pranavan hamming
# -*- coding: utf-8 -*-
# @param u : un mot de longueur n
# @param v : un mot de longueur n
# @contrainte Longueur de u et v dois être égale
# @return -1 si longueur de u et v ne sont pas égale
def hamming(u,v):
tmp=0
if(len(u)!=len(v)):
return -1
for i in range(len(u)):
if(u[i]!=v[i]):
tmp=tmp+1
return tmp
import sys
sys.path.append('../src')
from hamming import hamming
import unittest
class TestHamming(unittest.TestCase):
def test_hamming(self):
result=hamming("mais","mats")
self.assertEqual(result,1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment