Page 82 - Code & Click - 6
P. 82

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.
            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
















            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. Once the script is created, you can execute the script to view the output.

            WORKING IN SCRIPT MODE
            The Script mode lets you create, save, open, execute, and close scripts.
            To create a new script:                                                         Time Saver
              1.  On the Menu bar, click the File menu.                                     New script: Ctrl + N
              2.  Select the New File option.
                  The untitled Editor window opens.


                   1


                   2                                                                                     3











              3.  Type the required Python commands in the scripts area.

            To save a script:
              1.  On the Menu bar, click the File menu.
              2.  Select the Save option.


            80
   77   78   79   80   81   82   83   84   85   86   87