Answers for "one line iteration with if-else python"

5

if statement in one-line for loop python

>>> [(i) for i in my_list if i=="two"]
['two']
Posted by: Guest on March-31-2020
0

for if else one line python

[ x if x%2 else x*100 for x in range(1, 10) ]
Posted by: Guest on November-23-2021

Code answers related to "one line iteration with if-else python"

Python Answers by Framework

Browse Popular Code Answers by Language