ternary_conditionals.py (Source)

condition = True
# Long version
if condition:
    x = 1
else:
    x = 0
# One liner
x = 1 if condition else 0
print(x)