Page 109 - Computer - 6
P. 109

Python Interpreter or Shell
          The Python Interpreter or Shell is present below the Menu Bar. It contains the Python command prompt
          >>>. Commands are typed at the prompt, and their results are displayed below the commands.

          Status Bar
          The Status Bar is present at the bottom of the IDLE window. It displays the line number and column
          number at which the cursor is in the Interpreter.

          PYTHON WORKING MODES
          Python provides two modes of working in the IDLE. Let us learn about them.
          1. Interactive Mode or Shell Mode: In the Interactive mode, each command is typed at the prompt.
          When we press the Enter key, the Interpreter executes the command and displays the result below the
          command. In the interactive mode, one command can be typed at a time. The commands are not saved,
          and hence, cannot be reused. The Interactive mode can display text messages, results of calculations,
          and values of variables.
          To use the Interactive mode, type a command at the prompt
          and press the Enter key.
          For example, type the following commands one by one at
          the prompt and press the Enter key after each command:
             •  print(“Welcome to Python”)
             •  30 + 20
          The  Interactive  mode  is  a  great  way  to  learn  Python
          commands and debug small code snippets.
          2. Script  Mode:  The  Script  mode,  also  known  as  Batch
          Processing mode, lets you execute several Python commands
          together  in a sequence. This  is done by  saving the  set of
          commands as a file called a script or program. The saved
          script  can  be  reused  later  as  required.  Once  the  script  is
          created, you can execute the script to view the output.

          WORKING IN SCRIPT MODE
          Most of your programming will be done in the Script mode. The Script mode lets you create, save, open,
          execute, and close scripts.                                                        Time Saver
          To create a new script:
            1.  On the Menu bar, click the File menu.                                         New script: Ctrl + N
                 The File menu opens.



          1                                                                   2.  Select the New File option.

          2                                                                3      The untitled Editor window opens.
                                                                              3.  Type the required Python
                                                                                  commands in the scripts area.









                                                                                                             107
   104   105   106   107   108   109   110   111   112   113   114