The ternary operator is an in-line if/else statement that many languages support natively; however, Python does not have a specific operator. Instead, it uses conditional expression resolution which was added in Python 2.5.
In-line if/else statement
An in-line if/else statement in Python looks like the following:
|
|
Output:
|
|
Breaking down the syntax,
|
|
Return the value of the “idle” stage for a blue/green deployment.
|
|
Output:
|
|