Possible Duplicate:
function in function
how can I make the func. show all the bad values and not just one?
def get_bad_results(person_results):
for i in person_results:
if i[1]>i[3] or i[1]<i[2]:
return i[0]
test_results = [["White blood cells",8.5,2,7],
["Neutrophils",5.3,2.5,5],
["Red blood cells", 12.4, 9,15]]
a = get_bad_results(test_results)
print a
show White blood cells
instead of
White blood cells, Neutrophils
The function will return the first occurrence that fits the statement. To return all, you could save them away in a list and when the loop is done, return the list.