SyntaxFix
Write A Post
Hire A Developer
Questions
You can also put the conditional expression in brackets inside the list comprehension:
l = [22, 13, 45, 50, 98, 69, 43, 44, 1] print [[x+5,x+1][x >= 45] for x in l]
[false,true][condition] is the syntax