python list comprehension if >0 convert to 1 else 0 code example
Example 1: list comprehension python if else
[statement if condition else statement for _ in iterable_object]
#statement are without assignment
Example 2: if else in list comprehension
[f(x) if condition else g(x) for x in sequence]