Can someone say why this doesn't work in Python? Is it simply invalid syntax or is there more to it?
arr[0] += 12 if am_or_pm == 'PM'
The error message:
File "solution.py", line 13
arr[0] += 12 if am_or_pm == 'PM'
^
SyntaxError: invalid syntax
This works:
if am_or_pm == 'PM': arr[0] += 12