Skip to content

Ternary operator in Python

Python has a ternary operator since version 2.5, and you can use it like that:

[sc name=”src” url=”https://stackoverflow.com/questions/394809/does-python-have-a-ternary-conditional-operator” ]

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.