Inline if-else expression must always contain the else clause.
x = 1 if y else 0
If you want to leave the value 'y' variable value unchanged - adding old 'x' value
(Else is needed due to syntax):
x = 1 if y else x
This piece of code leaves x unchanged when y turns to be False.
Hope this helps!!
If you need to know more about Python, join Python online course today.