mardi 19 avril 2016

Getting a "list index can't be a float" error when i use the same iterator from a loop in an if statment in Python 3.4

i try to iterate through a list and check each value if it is a negative number

for i in listy: if (listy[i]<0):...

for some reason python tries to evaluate listy[0.5]<0 which is the 1st item on the list. How can i fix this ?

Aucun commentaire:

Enregistrer un commentaire