else statement python list comprehension code example Example: else statement python list comprehension >>> [a if a else 2 for a in [0,1,0,3]] [2, 1, 2, 3]