Page 131 - TP_Prime_v2.2_Class_6
P. 131

Interactive Mode
                 Each code line is executed and output is seen on the next line. Interactive mode gives

                 output line by line. It is mainly used to test the code for errors.

                 To work in the interactive mode, follow the below steps:

                 Step 1:  Click on the Start à Python 3.7 folder.
                 Step 2:  Click on the IDLE(Python 3.7 64-bit). The Python Shell window opens where you

                          can see the prompt (>>>).                                                                          INTRODUCTION TO PYTHON
                 Step 3:  Type the following on the Python Shell and see the output:










                                                                                                                          129







                                                         Python Shell Window

                 How does the Interactive Mode Works?
                 When we type on the screen next to the prompt (>>>), the interpreter converts the written

                 command into machine code. For the output, the machine code is converted into the human
                 readable format by the same interpreter.

                 From  the  above  screen,  Python  can  be  used  to  solve  high-level  complex  mathematical
                 problems or as well as simple arthematic calculations.



                         Fun            If an expression is written in Python IDLE prompt and Enter key is
                         Fact!        pressed, the interpreter will display the result in the next line once it
                                      processes it.


                  Script Mode

                 We learnt in the interactive mode that Python automatically processes the expressions or
                 inputs provided by the user and displays the result. In the script mode, Python does not

                 automatically process and display the result. The script mode is used to write longer Python
                 codes. It also allows you to save the programs for later use.

                 Perform the following steps to use the script mode:

                 Step 1:  Click on the File à New File option.
   126   127   128   129   130   131   132   133   134   135   136