The ternary conditional operator is a short-hand method for writing an if/else statement.
Does Python Have a Ternary Conditional Operator? Yes, it does.
This remids me that Eiffel, at least “ISE Eiffel” does actually have conditional expressions that are the same: <span class="kwd">answer := if</span><span class="pln"> time < noon </span><span class="kwd">then</span>
<span class="str">"Good morning"</span>
<span class="kwd">else "Good afternoon"</span>
<span class="kwd">end</span>
Pages: 1 2