Page 126 -
P. 126

functions



                     Test Drive




           See what happens when you run the new program. Make the required
           changes in IDLE and take your new program for a spin:









                                                                                  The code has been
                                                                                  amended to include
                                                                                  the “get_price()"
                                                                                  function.

















            If you need the price
            right now, this program
            wastes no time in giving
             it to you. Note: that's
             an UPPERCASE “y”.





                                                  If you’re happy to wait, the program will
                                                 (eventually) tell you when the price is right.





                                       Design principle: reuse code with functions.





                                                                                        you are here 4    91
   121   122   123   124   125   126   127   128   129   130   131