I'm sure this must be simple, but I'm a python noob, so I need some help. I have a list that looks the following way:
foo = [['0.125', '0', 'able'], ['', '0.75', 'unable'], ['0', '0', 'dorsal'], ['0', '0', 'ventral'], ['0', '0', 'acroscopic']]
Notice that every word has 1 or 2 numbers to it. I want to substract number 2 from number 1 and then come with a dictionary that is: word, number. Foo would then look something like this:
foo = {'able','0.125'},{'unable', '-0.75'}...
it tried doing:
bar=[]
for a,b,c in foo:
d=float(a)-float(b)
bar.append((c,d))
But I got the error:
ValueError: could not convert string to float: