I still don't get it yet how the 2D list/array works to figure out the cost between the strings (Is the tuple in matrix[len(a)][len(b)] right ?
I would like some explanation please kk
I have something going on already. I filled the base cases but don't know how to access the tuples already filled to compute all other cells the code:
from enum import Enum class Operation(Enum): """Operations""" DELETED = 1 INSERTED = 2 SUBSTITUTED = 3 def __str__(self): return str(self.name.lower()) def distances(a, b): """Calculate edit distance from a to b""" # generating 2d list matrix =  for i in range(len(a)+1): #string a and rows matrix.append() for j in range(len(b)+1): #string b and columns matrix[i].append(0) # base cases c = 1 for i in range(len(a)): matrix[i+1] = (c, Operation.DELETED) c += 1 c = 1 for j in range(len(b)): matrix[j+1] = (c, Operation.INSERTED) c += 1 #filling in for i in range(len(a)): for j in range(len(b)): matrix[i+1][j+1] = ('x','y') print(matrix) distances('cat','ate')