functions and branching another point on the line (floatsreturnab (floatsfor the line ( = * + "" ( )/( * return ab doc strings do not take much time to writeand are very useful for others who want to use the function widely accepted convention in the python communitydoc strings are also used by various tools for automatically generating nicely formatted software documentation much of the online documentation of python libraries and modules is automatically generated from doc strings included in the code if-tests for branching the program flow in computer programs we often want to perform different actions depending on condition as usualwe can find similar concept in mathematics that should be familiar to most readers of this book consider function defined in piecewise mannerfor instancesin < < ( otherwise the python implementation of such function needs to test the value of the input xand return either zero or sin(xdepending on the outcome such decision in the program code is called branching and is obtained using an if-testormore generallyan if-else block the code looks like from math import sinpi def ( )if < <pireturn sin(xelsereturn print( ( )print( ( *pi)the new item here is the if-else block an if-test is simply constructed by the keyword if followed by boolean variable or expressionand then block of code which is to be executed if the condition is true when the iftest is reached in the function abovethe boolean condition is testedjust as for the while loops in the previous if the condition is truethe following block of indented code is executed (in this casejust one line)if notthe indented code block after else is executed you might also notice