Page 47 -
P. 47

code is a highway





                                                You needed to decide what messages should be displayed to the
                                                user. Below is a table showing some typical values the user might
                                                enter. What did you think the message should say?




                                     Program Modification


                                       Number entered  Message to display
                                               3
                                                                  T oo low
                                              5
                                                                 You win!
                                              7
                                                                 T oo high
                                              8
                                                                T oo high











           A program is more than a list of commands



          You could create a program that was simply a list of commands. But you
           almost never will. This is because a simple list of commands can only be
                                                                                 print(), input(), and int()
           run in one direction. It’s just like driving down a straight piece of road:
           there’s really only one way of doing it.                              are examples of commands
                                                                                 that you've already seen.



                                                                               print
                                   print
                                                                              ("Come
                                ("Howdy!")
                                                                              again!")






           But programs need to be much smarter than that.




           12    Chapter 1
   42   43   44   45   46   47   48   49   50   51   52