Answers for "list comprehension for loop and if else"

0

else statement python list comprehension

>>> [a if a else 2 for a in [0,1,0,3]]
[2, 1, 2, 3]
Posted by: Guest on May-27-2021

Code answers related to "list comprehension for loop and if else"

Python Answers by Framework

Browse Popular Code Answers by Language