Python ternary operator
The ternary operator aims at reducing multiple lines of if-else complexity into a single line. The Ternary operator works upon, where the result of an expression (conditional expression) depends on the True or False value. Bottom line – Consolidate (or condense) multi line expression in one line. If-else can be re-written in one line using the ternary operator.