Python jika lain versi pendek
x = 10 if a > b else 11
MrStonkus
x = 10 if a > b else 11
x = 'foo' if bar else 'baz'
>>> [(i) for i in my_list if i=="two"]
['two']
# value_when_true if condition else value_when_false