Python, если еще одна линия
x = 'foo' if bar else 'baz'
slgotting
x = 'foo' if bar else 'baz'
value_when_true if condition else value_when_false
Better Example: (thanks Mr. Burns)
'Yes' if fruit == 'Apple' else 'No'
Now with assignment and contrast with if syntax
fruit = 'Apple'
isApple = True if fruit == 'Apple' else False
vs
fruit = 'Apple'
isApple = False
if fruit == 'Apple' : isApple = True
a = int(input("Enter an Integer"))
print("value entered by user is less than 50) if a < 50 else print ("value entered by user is greater than 50)