Page 119 - Trackpad_V1_Book 6_Flipbook
P. 119

PROGRAMMING MODES IN PYTHON

                 Python provides two basic programming modes: Interactive Mode and Script Mode.


                 INTERACTIVE MODE (IDLE SHELL WINDOW)

                 The IDLE Shell window is an interactive window where we can type a Python code and view the
                 output in the same window. In the IDLE Shell window, the >>> sign appears. Here, we can type our
                 code and get output by pressing the Enter key.





















                             Short key  To close IDLE window:              Subject: To exit IDLE window



                                                                           To exit  the  IDLE window, click  on
                                    Ctrl +
                                                D
                                                                           File menu
                                                                                       Exit option.



                 SCRIPT MODE (EDITOR’S WINDOW)
                 Python Shell does not allow you to save our commands written on the command prompt, it gives

                 output immediately after pressing the Enter key. If you want to see all the output after completion
                 of the code, then you can use the Python script mode. It also allows you to type multi-line codes
                 that we save for further use.
                 To open Python Editor’s Window: click on the File Menu    click on the New File options.
















                 The output is displayed in the next line in the same Python Shell window.





                                                                                             Introduction to Python  117
   114   115   116   117   118   119   120   121   122   123   124