writing if statement in one line python code example
Example 1: 1 line if statement python
value_when_true if condition else value_when_false
Example 2: one line if statement python
var = [expression1] if [condition] else [expression2]
value_when_true if condition else value_when_false
var = [expression1] if [condition] else [expression2]