Page 135 - Computer Science V2.0 Class 11
P. 135

Fig 5.7: Result of executing the Python script

                 Instead of the click sequence RUN-> Run Module(F5), we could also use the short key <F5> (<ctrl> <F5> on some
                 systems). On pressing the key <F5>, IDLE executes the current script if the current version of the script is already saved.
                 However, if the script is not already saved, IDLE prompts the user to save the script, as shown in Fig 5.8.















                                                     Fig 5.8: IDLE's prompt to save the script

                 Once the script is saved, it is executed by IDLE, and the result is displayed in the IDLE's Shell. Congratulations! You have
                 implemented the first Python program successfully.

                 Having already dealt with text, let us evaluate some numerical expressions in the Python shell (see Fig 5.9).






















                                              Fig 5.9: Evaluating numerical expressions in Python Shell
                 Finally, two more details about the Python Shell:
                 ● To repeat the previous command: Press Alt+P
                 ●  To repeat an earlier command, move the cursor to that command, click the mouse button and press the Enter
                   key. Now the command will appear as the current command, which can be executed, possibly after making some
                   changes.



                        Press Alt+P to repeat the previous command in the Python Shell







                                                                                Getng Started with Python Programming  121
   130   131   132   133   134   135   136   137   138   139   140