Python's "if" is a _statement_, and there is no conditional _operator_ (like C's "a?b:c" ternary) that we could use where expressions are needed (lambdas, etc); however, with some due care, equivalents can easily be coded.
Python, 31 lines
Python lacks a ternary operator like C's cond?iftrue:iffalse -- and generally it's all the better off for that; in the rare cases where it's needed (because 'if-else' is a _statement_, and we need something that fits into an _expression_ instead), we can synthesize it with indexing, or, when shortcircuiting is needed to avoid evaluating an incorrect expression, with the 'and' and 'or' operators.
The short-circuit case can be tricky indeed, because the 'iftrue' part could be 0 (or some other 'false' value); wrapping iftrue and iffalse up into one-element (thus non-empty, thus 'true') lists, and indexing the result, avoids this further risk of anomaly.
Such tricky subtleness can hardly ever meet the prime guideline of programming, "Do the Simplest Thing that Can Possibly Work", particularly because it's likely to be conjoined with 'lambda' or other subtlety-prone constructs. 99.44 times out of 100, you will be better off passing a named local function, with a plain if/else statement. But, for the remaining 56 cases out of 10,000, these idioms can still be useful.