are called and used and give sensible output if we run the file with python interest py howeverif we add regular function callsprint statements and other code to the filethis code will also be run whenever we import the modulewhich is usually not what we want the solution is to add such example code in test block at the end of the module file the test block includes an if-test to check if the file is imported as module or if it is run as regular python program the code inside the test block is then executed only when the file is run as programand not when it is imported as module into another program the structure of the if-test and the test block is as followsif __name__ ='__main__'this test defines the test block the key is the first linewhich checks the value of the built-in variable __name__ this string variable is automatically created and is always defined when python runs (try putting print(__name__inside one of your programs or type it in an interactive session inside an imported module__name__ holds the name of the modulewhereas in the main program its value is "__main__for our specific casethe complete test block can look like if __name__ ='__main__' a_ present_amount(prnp_ initial_amount(arnn_ years(parr_ annual_rate(panprint( ' ={a_({ } ={p_({ } ={n_({ } ={r_({ })'test blocks are often included simply for demonstrating and documenting how modules are usedor they are included in files that we sometimes use as stand-alone programs and sometimes as modules as indicated by the namethey are also frequently used to test modules using what we learned about test functions in the previous we can do this by writing standard test function that tests the functions in the moduleand then simply calling this function from inside the test blockdef test_all_functions()define compatible values given three of thesecompute the remaining one and compare with the correct value (in parenthesisa_computed present_amount(prnp_computed initial_amount(arnn_computed years(parr_computed annual_rate(pandef float_eq(abtolerance= - )