Python If Else Short Version
x = 10 if a > b else 11
MrStonkus
x = 10 if a > b else 11
a = '123' if b else '456'
a = '123' if condition else '456'
#is the same as
if condition:
a = '123'
else:
a = '456'
# Traditional Ternary Operatorcan_vote = (age >= 18) true : false;# Python Ternary Operatorcan_vote = True if age >= 18 else False