# Revision history [back]

### Conditional in list

If this works

[1  if i<12 else (0 if 12<= i <=15 else 2) for i in range(20)]


where is my fault with

cand=["A","B","C","D"] cond1=[[141,107],[163,85],[127,121],[132,116],[117,131],[120,128]] cond2=[(["A","B"],"A"),(["A","C"],"A"),(["A","D"],"A"),(["B","C"],"B"),(["B","D"],"D"),(["C","D"],"D")] zoo=[[0 if cond2[i][1]==cand[j] else ((abs(cond1[i][0]-cond1[i][1])) if cond2[i][0][0]=cand[j] or cond2[i][0][1]=cand[j]) for i in range(len(cond2))] for j in range(len(cand))] zoo

### Conditional in list

If this works

[1  if i<12 else (0 if 12<= i <=15 else 2) for i in range(20)]


where is my fault with

cand=["A","B","C","D"]
cond1=[[141,107],[163,85],[127,121],[132,116],[117,131],[120,128]]
cond2=[(["A","B"],"A"),(["A","C"],"A"),(["A","D"],"A"),(["B","C"],"B"),(["B","D"],"D"),(["C","D"],"D")]
zoo=[[0   if cond2[i][1]==cand[j] else ((abs(cond1[i][0]-cond1[i][1])) if cond2[i][0][0]=cand[j] or cond2[i][0][1]=cand[j]) for i in range(len(cond2))] for j in range(len(cand))]
zoozoo