else statement python list comprehension

Solutions on MaxInterview for else statement python list comprehension by the best coders in the world

showing results for - "else statement python list comprehension"
Manuel
26 Mar 2017
1>>> [a if a else 2 for a in [0,1,0,3]]
2[2, 1, 2, 3]
3