How to use Python Ternary Operator