what is the ternary operator in python

Solutions on MaxInterview for what is the ternary operator in python by the best coders in the world

showing results for - "what is the ternary operator in python"
Germaine
21 Jul 2017
1condition = True
2print("This condition is true!") if condition else print("This condition is false!")
3
Ben
06 Oct 2018
1condition = True
2print("This condition is true!") if condition else print("This condition is false!")
3# The if statement in one line! (Ternary operator)