Yes, Python has a ternary conditional operator, which is a shorthand way of writing an if-else statement. The syntax for a ternary conditional operator in Python is:
[on_true] if [expression] else [on_false]
For example, the following code:
x = 10 y = 20 max = x if x > y else y
Learn Flask development and learn to build cool apps with our premium Python course on Udemy.