This question is very much like: if/else in Python's list comprehension? and Simple syntax error in Python if else dict comprehension . But still i dont understand what
Switch the if i!=0 and for i in range(2) parts:
if i!=0
for i in range(2)
>>> [i for i in range(2) if i!=0] [1] >>>