like overkill to spread them across four lines at other timeswe may want to nest such construct in larger statement instead of assigning its result to variable for these reasons (andfranklybecause the language has similar tool)python introduced new expression format that allows us to say the same thing in one expressiona if else this expression has the exact same effect as the preceding four-line if statementbut it' simpler to code as in the statement equivalentpython runs expression only if turns out to be trueand runs expression only if turns out to be false that isit short-circuitsjust like the boolean operators described in the prior sectionrunning just or but not both here are some examples of it in actiona 'tif 'spamelse 'fa 'ta 'tif 'else 'fa 'ffor stringsnonempty means true prior to python (and after if you insist)the same effect can often be achieved by careful combination of the and and or operatorsbecause they return either the object on the left side or the object on the right as the preceding section describeda (( and yor zthis worksbut there is catch--you have to be able to assume that will be boolean true if that is the casethe effect is the samethe and runs first and returns if is trueif if false the and skips yand the or simply returns in other wordswe get "if then else this is equivalent to the ternary forma if else the and/or combination form also seems to require "moment of great clarityto understand the first time you see itand it' no longer required as of --use the equivalent and more robust and mnemonic if/else expression when you need this structureor use full if statement if the parts are nontrivial as side noteusing the following expression in python is similar because the bool function will translate into the equivalent of integer or which can then be used as offsets to pick true and false values from lista [zy][bool( )for example[' '' '][bool('')' [' '' '][bool('spam')'thoweverthis isn' exactly the samebecause python will not short-circuit--it will always run both and yregardless of the value of because of such complexitiesyou're the if/else ternary expression