/Python-Examples

Interview Questions

Primary LanguagePython

IF-ELSE in one line

some_expression if condition else other_expression

Example:

counter = (counter + 1) if val > 10 else (counter - 1)