computing integrals we just put the statements we otherwise would have put in main programinside functiondef application()from math import exp lambda *( ** )*exp( ** input(' 'numerical trapezoidal( ncompare with exact result lambda texp( ** exact ( ( error exact numerical print ' =% ferror% (nnumericalerrornow we compute our special problem by calling application(as the only statement in the main program both the trapezoidal and application functions reside in the file trapezoidal pywhich can be run as terminal terminalpython trapezoidal py = error- making module when we have the different pieces of our program as collection of functionsit is very straightforward to create module that can be imported in other programs that ishaving our code as modulemeans that the trapezoidal function can easily be reused by other programs to solve other problems the requirements of module are simpleput everything inside functions and let function calls in the main program be in the so-called test blockif __name__ ='__main__'application(the if test is true if the module filetrapezoidal pyis run as program and false if the module is imported in another program consequentlywhen we do from trapezoidal import trapezoidal in some filethe test fails and application(is not calledi our special problem is not solved and will not print anything on the screen on the other handif we run trapezoidal py in the terminal windowthe test condition is positiveapplication(is calledand we get output in the windowterminal terminalpython trapezoidal py = error- -