Skip to content

Latest commit

 

History

History
32 lines (19 loc) · 513 Bytes

File metadata and controls

32 lines (19 loc) · 513 Bytes

Hamming Distance

In informatics, Hamming distance is the number of positions where the characters differ between two strings of equal length

Install

pip install allalgorithms

Usage

>>> from allalgorithms.sorting import hamming_dist

>>> hamming_dist("hello world", "hello wario")
3

API

hamming_dist(seq1, seq2)

Returns an integer

Raises a ValueError if strings are of unequal length

Params:
  • seq1: first string to compare
  • seq2: second string to compare