Sorry, the code shown in the two Python interpreter sessions above, is not a good example. To make the concept of conditional expressions more clear, this example is better:
>>> from __future__ import print_function
>>> for i in range(3, 5):
... print(i, "is", "odd" if i % 2 == 1 else "even")
...
3 is odd
4 is even
which can be shortened to this: >>> for i in range(3, 5):
... print(i, "is", "odd" if i % 2 else "even")
...
3 is odd
4 is even
Now print() is printing 3 values: i, "is", and either "odd" or "even" based on the boolean condition.That works in both Python 2 and 3.
Maybe I misunderstood your context, but if not, conditional expressions do exist in Python:
Using nested conditional expressions to classify characters:https://jugad2.blogspot.com/2017/04/using-nested-conditional...