In Python, there is no trailing if statement. So you can not write inline if statement for print:-
In Python, there are two kinds of if statements:
Also, note that as you have written both print a and b = a are statements. Only the a part is an expression.
So if you write:-
print a if b else 0
Then it means:-
print (a if b else 0)