This is another one of those ways to make your code more concise while still keeping it readable:
[on_true] if [expression] else [on_false]
As an example:
x = "Success!" if (y == 2) else "Failed!"
Another example
def compare(a,b):
if a> b:
return a
else:
return b
Using Ternary Operator
def compare(a, b):
return a if a> b else b