Page 43 -
P. 43

test drive



                     Test Drive




           To run the program, you need to make sure that the edit window for
           the game.py program code is selected. Each time you run (or rerun)   When you run your code within IDLE,
           the program, you need to click on the IDLE edit window and choose   any messages appear within the Python
           the Run Module option from the Run menu. The word module is       Shell, not within the edit window.
           a name that IDLE uses to refer to your program code.              IDLE automatically makes the shell the
           Here’s what happens when you run the code:                        currently selected window the instant
                                                                             your program runs.












                                             A couple of incorrect guesses...










                                             ...and then the correct
                                             answer.











           Congratulations! The program works.

           Each time you run the code, it displays a “Welcome!” message,
           accepts input from the keyboard, and then tells us whether or not
           we guessed the right answer. That means the program is accepting
           input, it’s processing the data, and then it generates output.





           8    Chapter 1
   38   39   40   41   42   43   44   45   46   47   48