Free lab Real Python 3. Zero installs. Your code stays in this browser. Open the playground

Edit Distance

Hard · 90 XP

Compute Levenshtein distance — the fewest single-character insertions, deletions or substitutions turning one word into another. Print it for four pairs.

Target output
'kitten' -> 'sitting': 3
'flaw' -> 'lawn': 2
'abc' -> 'abc': 0
'' -> 'hello': 5
Blank · autosaved
PYword-ladder-cost.py
Run your code to check it…
Your next ten minutes

Write Python that does something useful.

Start free. No install, no card, no passive video marathon.

Start learning free → Explore the path