4 ms·
Why? It's not hard to write a quick and dirty levenshtein function, but when google gets it for me in 1 minute, why do it? edit: just for fun, as a one-liner:
by llimllib 15y ago
Why? It's not hard to write a quick and dirty levenshtein function, but when google gets it for me in 1 minute, why do it?
edit: just for fun, as a one-liner:
def levenshtein(a,b): return sum(x!=y for x,y in zip(a, b))
edit 2: and just to clarify, I know this fails if the lengths of the input strings differ, they were guaranteed to be equal in my code.