Ternary Operator in Python

The python ternary operator is very simple and easy to use.

Syntax:

Example 1:

Output :

2

Example 2:

output:

not equal to 2