For example my code looks like this :
for item in mylist:
while (function(item)==True): #my function returns boolean True or False
if (((list(str(item)))[:2]) == ['4','1']:
j+=1
if (((list(str(item)))[0]) == '1'):
k+=1
But I get this error message: if (((list(str(item)))[0]) == '1'): IndexError: list index out of range
Aucun commentaire:
Enregistrer un commentaire