Page 40 -
P. 40

starting to code


           So how do you run your code?


           There are two things that you will need to run the guessing-game
           program: an editor and an interpreter.

           The editor saves the code you write into a file on your hard disk. The
           code (sometimes called the source code) is just text, and it can be
           written and read by humans.


                                                                 The editor will save the
                                                                 source code into a file.

                                                                .py





                              The source code


           But computers can’t process text meant for humans, at least not very well.
           That’s why we need a tool to translate the human-friendly source code    Hmmm... looks
           into the binary 1s and 0s that computers do understand. That’s what an   like a guessing
           interpreter does. In this book, an interpreter called Python is used.    game...




                                                               The Python
                                                               interpreter



                                          .py
                                                 The interpreter translates
                                                 the text of the source
                                                 code into language that the
                                                  computer can understand.



           So we need an editor and a Python interpreter. Fortunately, Python 3
           comes with a built-in application called IDLE, which does both jobs and
           more. IDLE enables you to write and edit Python code, it translates this
           code into binary form, and finally, it runs the Python 3 program. Because
           of this, IDLE is known as an Integrated Development Environment.

           Let’s see these steps in action.

                                                                                         you are here 4    5
   35   36   37   38   39   40   41   42   43   44   45