Ternary operator in python

Ternary Operators Ternary Operators are your classic if-then-else statements, but expressed in a single line. For example: Can be translated to: Syntax An if-then-else statement MUST have an else argument, otherwise your code will crash. You can also nest these statements; however, it is best practice to simply write the if statements separately if you have more than one expression.

Read More