Out of all the little lists, I have to make one list with the maximum even number out of each of the lists. If the list has odd numbers then the maximum is 0. So far my code is:
a=[] b=[] c='' d='' e='' for i in range (len(res)): for j in range (len(res)): d=res[i][j] if (d%2 == 0): d=d a.append(d) else: d= 0 a.append(d) c = max(a) b.append(c) print b The list is [[1,2,3],[6,5,4],[5,7,9]] and I need to get [2,6,0] but instead I keep getting [2,6,6]