functions and branching < <= < ( <= < >= which in python can be implemented with multiple if-else-branching def ( )if return elif < return elif < return elif > return in later we will see multiple examples of more general use of branchingnot restricted to mathematics or piecewise-defined functions inline if-tests for shorter code the list comprehensions in offered more compact alternative to the standard way of defining listsand similar alternative exists for if-tests common use of if-else blocks is to assign value to variablewhere the value depends on some conditionjust as in the examples above the general form looks like if conditionvariable value elsevariable value this code can be replaced by the following one-line if-else blockvariable (value if condition else value using this compact notationwe can write the example from the start of this section as def ( )return (sin(xif < <pi else functions as arguments to functions arguments to python functions can be any python objectincluding another function this functionality is quite useful for many scientific applicationswhere we need to define mathematical functions that operate on or make use of other mathematical functions for instancewe can easily write python functions for numerical approximations of integrals ( )dxderivatives ( )and roots ( for such functions to be general and usefulthey