I have a list of ints (hitTableWord) and I am trying to add 1 over the absolute value of the numbers for the whole list and I keep getting this error message in python: metric = metric + 1/(abs(metricNumber)) TypeError: unsupported operand type(s) for +: 'type' and 'float'. metric was initialized as: metric = 0
Thing is I am a rookie programmer and don't know what it means.
for a in range (0, len(hitTableWord)):
output_file.write('Hit Word: '+ str(hitTableWord[a]) +' ' + str(hitTableNear[a])+ ', ')
metric = metric + 1/(abs(hitTableWord[a]))
Any help would be appreciated. As usual with my questions I am sure it is something ridiculously simple that I just do not know about. So thanks for all your patience.