# pset 6 similarities more '<' not supported between instances of 'str' and 'int' error while compiling in helpers.py distances

heres my code

``````from operator import itemgetter

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"""

len_a = len(a)
len_b = len(b)

twod = [[ ("0","none") for j  in range(len_b + 1)] for i in range(len_a + 1)]

for i in range(1,len_a + 1 ):
twod[i] = (i,"D")

for j in range(1,len_b + 1 ):
twod[j] = (j,"I")

for i in range(1,len_a + 1):
for j in range(1 , len_b + 1):

# what woud be cost if the twod[i][j] is taken from twod[i-1][j-1]
if (a[i] == b[j]):
c = twod[i-1][j-1]
else:
c = twod[i-1][j-1] + 1

# writing a temporary list which could directly give the operation based on the position of min cost
arr_list = [(twod[i-1][j]+1,'D'),(twod[i][j-1]+1,'I'),(c,'S')]

# getting the (cost,operation) into twod[i][j] based on min cost
twod[i][j] = min(arr_list, key=lambda x:x)

return twod
``````

here is the error

``````~/similarities/ \$ ./score LesMis1.txt LesMis2.txt
Traceback (most recent call last):
File "./score", line 35, in <module>
main()
File "./score", line 30, in main
d = distances(file1, file2)
File "/home/ubuntu/similarities/helpers.py", line 43, in distances
twod[i][j] = min(arr_list, key=lambda x:x)
TypeError: '<' not supported between instances of 'str' and 'int'
``````

This particular issue is with `("0","none")`, you probably meant `(0, None)` (`None` is a special value, describing the absence of something).
Unrelated, you shouldn't use `"D"` but `Operation.DELETED`.
And you should `if (a[i - 1] == b[j - 1]):` (you start the loop with the index at 1, but want to start comparing the string at index 0).