How to condense if/else into one line in Python?
To condense if/else into one line in Python an example of Python's way of doing "ternary" expressions:-
i = 5 if a > 7 else 0
Translates into:-
if a > 7:
i = 5
else:
i = 0