The Python if
ternary operator syntax requires an else
, like so:
x = 2 if y < 5 else 4
solved Shorthand ‘if’ is throwing a syntax error
The Python if
ternary operator syntax requires an else
, like so:
x = 2 if y < 5 else 4
solved Shorthand ‘if’ is throwing a syntax error