python shorthand if statement code example Example 1: short if python a = '123' if b else '456' Example 2: short if else in python x = 10 if a > b else 11