How to write inline if statement for print?

How to write inline if statement for print?

You can use a conditional expression within the print function:

# Example 1
print("True" if True else "False")

You can also, assign the result of the conditional expression to a variable and then print the variable:

Example 2

result = "Even" if x % 2 == 0 else "Odd"
print(result)

Define a lambda function and immediately call it with the desired arguments:

Example 3

print((lambda y: "Positive" if y > 0 else "Non-positive")(y))