Ternary Operator in Python

Python 2.5 introduced a shorthand operator, known as ternary operator. This operator requires three operands and performs a conditional test based on a condition being True or False. Python supports only one ternary operator. It is also known as a…

