Does Python have a ternary conditional operator?
Yes, it was added in version 2.5. The expression syntax is: First condition is evaluated, then exactly one of either a or b is evaluated and returned based on the Boolean value of condition. If condition evaluates to True, then a is evaluated and returned but b is ignored, or else when b is evaluated … Read more