[PYTHON] Unfamiliar if statement

Unfamiliar if statement


print 'a' if False else 'b'
print 'A' if True else 'B'

Output result


b
A

What is this feeling of coming out later. .. ..


Postscript

This is the python ternary operator Thanks to @zetamatta for teaching me

@Tadsan explains in detail in the comment section.

Recommended Posts

Unfamiliar if statement
Python if statement
[Python] if statement
Python basic if statement
Julia quick note [05] if statement
Addition with Python if statement
About 2-variable, 4-branch if statement
[python] Correct usage of if statement
[Python] File operation using if statement
Swap 1 and 2 without using an if statement
return statement
while statement