Page 80 - TP_Modular_V2.1_Class6
P. 80

Working in Interactive Mode                                                                                               Working in Script Mode

                  Interactive Mode is a command line shell which gives immediate result for each command. In                                The Interactive Mode does not save the commands entered by the
                  Interactive mode, we type one command at a time. Python executes the given command and                                    user in the form of a program. The Script Mode saves the commands
                  gives the output.                                                                                                         entered by the user in the form of a program. To understand the
                  Follow these steps to start Python and work in Interactive Mode:                                                          working  of Script Mode, we have divided the process into four

                  Step 1   Click on Start button.                                                                                           parts. Let us discuss these.
                                                                                                                                            Creating a New File
                  Step 2    Scroll down the list of programs and click on Python
                            3.12 folder.                                                                                                    Follow these steps to create a new file:
 Selecting New File option
                  Step 3   Click on IDLE (Python 3.12 64-bit).                                                                              Step 1    Open the Python IDLE window.

                  The main IDLE window appears. IDLE stands for Integrated                                                                  Step 2   Click on the File menu. A drop-down menu appears.
                  Development and Learning Environment. It is a code editor                                                                 Step 3    Click on the New File option. A new editor window with
                  which helps you to write and execute Python programs in the                                                                         a blank file will appear on the screen.
                                                                                                Opening Python
                  editor itself.
                                                                                                                                            Writing a Program
                  Components of Python Window                                                                                               Type the program code in Python window.                                    Selecting New File option

                  There are two components of Python IDLE window:

                       Menu Bar: The Menu Bar of Python IDLE window is similar to the Menu Bar of other programs.
                      It has various menus such as File, Edit, Shell, Debug, Options, Window and Help.

                       Prompt: You will see a blinking cursor after the symbol (>>>) in the window. This is known
                                                                                                                                                                                  Typing Python program code
                      as the Prompt. The Prompt allows the user to enter commands directly into Python and get
                      an output instantly by pressing the Enter key.                                                                        Saving Python Program
                                                                                                                                            Follow these steps to save a Python program.
                            Menu
                                                                                                                                            Step 1   Click on the File menu.
                             bar
                                                                                                                                            Step 2   Click on the Save option. The Save As dialog box appears.
                           Prompt                                                                                                           Step 3   Select the desired location to save the file.

                                                           Components of IDLE                                                               Step 4   Enter the name of the file in the File name box.
                                                                                                                                            Step 5    Click on Save button. The file will be saved by the given name     Saving a Python program
                  Type the commands at the prompt and you will immediately get the results. Simply, type 3 +
                                                                                                                                                      at the selected location
                  3 and press the Enter key. The result 6 appears on the screen. Try more values and see what
                  happens.

















                                                            Typing commands                                                                                                           Save As dialog box


                   78       Modular (Ver. 2.1)-VI
   75   76   77   78   79   80   81   82   83   84   85