Can we chain the ternary operator in Python? We can do it for multiple if
conditions in Java. Can that be done in Python too?
Can we chain the ternary operator in Python? We can do it for multiple if
conditions in Java. Can that be done in Python too?
Yes.
x = 'x' if 1<0 else 'y' if 0<1 else 'z'