Page 297 - Artificial Intellegence_v2.0_Class_9
P. 297

Interactive mode

               • Script Mode (Editor): In this mode, you save all your commands together in any text editor
              with the extension .py. When we run this text file.py then the output of the commands will
              be displayed in Shell mode. The steps to create and run script file in script mode are:

               Step 1   Click on the File  New File option in Shell mode. A new blank text editor
                       appears.
               Step 2   Type the commands and then click on the File  Save as option to save the
                       file. The Save As dialog box appears.
               Step 3   Select the desired location to save the file and type the file name in the File   New File option
                       name box. In this case, we have typed the file name as MyFirstFile.py.











                                                            Script mode
               Step 4   Click on the Run  Run Module or press F5 key to run the program. The program will execute and
                       the output will be shown in the Shell window.















                                                         Running a script


                            Task                                                                    Experiential Learning



                 Colab—a free Jupyter notebook environment that runs entirely in the cloud allows you
                 to write and execute Python code. Type http://colab.research.google.com to create your
                 online Python notebooks which can be simultaneously edited by the members with whom
                 you have shared your code in Colab. This process is similar to the way you edit documents
                 in Google Docs, Google Sheets or Google Slides.


                                                                                   Introduction to Python  295
   292   293   294   295   296   297   298   299   300   301   302