for i in range(1, len(xLine) + 1):
    for j in range(1, len(yLine) + 1):
        array[i][j] = min(array[i - 1][j] + diff('-', xLine[i - 1],
            costBook), array[i][j - 1] + diff(yLine[j - 1], '-', costBook),
            array[i - 1][j - 1] + diff(yLine[j - 1], xLine[i - 1], costBook))
return array
Computing edit distance of DNA sequence python