Does Ternary Operator available in Python
Yes, Ternary Operators are conditional operator, it evaluate condition, if it’s true it return one value or another value. It’s added in python 2.5 version onwards.
#Example program on python ternary operator
[true] if [expression] else [false]
#heighest high comparision
a_height = 5.3
b_height = 5.6
result = b_height if b_height> a_height else a_height
print(result)
Output:
5.6
If you have any alternative methods or procedures for same requirement, you can comment below.