additional python conveniences in this sectionwe introduce several features of python that are particularly convenient for writing cleanconcise code each of these syntaxes provide functionality that could otherwise be accomplished using functionality that we have introduced earlier in this howeverat timesthe new syntax is more clear and direct expression of the logic conditional expressions python supports conditional expression syntax that can replace simple control structure the general syntax is an expression of the formexpr if condition else expr this compound expression evaluates to expr if the condition is trueand otherwise evaluates to expr for those familiar with java or ++this is equivalent to the syntaxcondition expr expr in those languages as an exampleconsider the goal of sending the absolute value of variablento function (and without relying on the built-in abs functionfor the sake of exampleusing traditional control structurewe might accomplish this as followsif > param elseparam - result foo(paramcall the function with the conditional expression syntaxwe can directly assign value to variableparamas followsparam if > else - result foo(parampick the appropriate value call the function in factthere is no need to assign the compound expression to variable conditional expression can itself serve as parameter to the functionwritten as followsresult foo( if > else -nsometimesthe mere shortening of source code is advantageous because it avoids the distraction of more cumbersome control structure howeverwe recommend that conditional expression be used only when it improves the readability of the source codeand when the first of the two options is the more "naturalcasegiven its prominence in the syntax (we prefer to view the alternative value as more exceptional