functions and branching from two lines to one line one answer is that the lambda function definition can be placed directly in the argument list of the other function instead of first defining (xand then passing it as an argumentas in the code abovewe can combine these tasks into one linedf diff (lambda xx** - , print(df using lambda functions in this way can be quite convenient in cases in which we need to pass simple mathematical expression as an argument to python function we save some typingand could also improve the code' readability solving equations with python functions solving equations of the form ( is frequently occuring task in all branches of science and engineering for special casessuch as linear or quadratic we have simple formulas that give us the solution directly in the general casehoweverthe equation cannot be solved analyticallyand we need to find an approximate solution using numerical methods we shall see that we can create powerful and flexible tools for equation solving based on the building blocks introduced so far specificallywe will combine functions and function arguments with the while loop introduced in finding roots on an interval with the bisection method one of the simplest algorithms for solving equations of the form ( is called the bisection method this method is founded on the intermediate value theoremwhich states thatif continuous function changes sign on an interval [abthen there must be value [absuch that ( in the bisection method we start by choosing an interval [abon which changes sign ( ( ) ( )and then compute the midpoint ( )/ and check the sign of (mif changes sign on [amthen we repeat the process on the interval [am]otherwisewe choose [mbas our new interval and repeat the process there these steps are conveniently implemented as while loopand we can create generic tool by placing the while loop inside function that takes function as argumentfrom math import exp def bisection( , , ,tol - )if ( )* ( print( 'no roots or more than one root in [{ },{ }]'return ( + )/ while abs( ( )tolif ( )* (