value = true-expr if condition else false-expr In [1]: x = 5 In [2]: 'Non-negative' if x >= 0 else 'Negative' Out[2]: 'Non-negative'