Page 135 - CodePilot V5.0 C6
P. 135

OPENING AN EXISTING PROGRAM


                 You can open an existing Python program to make changes or run it again. To open an existing
                 Python program, follow the given steps:


                     1    Click on the File menu.                                        4    Select the program file.



                   2    Click on the Open option.
                      The Open dialog box will
                                     appear.
                                                                    3    Navigate to the
                                                                    location where you
                                                                   have saved your file.  5    Click on the Open button.


                 The selected Python program is now open in the editor, ready for you to modify or execute.















                        INPUT AND OUTPUT


                 Python provides built-in functions to interact with users and handle input and output operations.

                 THE INPUT( ) FUNCTION

                 The input() function is used to take input from the user. It reads a line of text entered by the user,
                 which is then returned as a string.
                 Syntax of input() function:


                 input(<prompt>)
                 Here, the prompt is the string or message you want to display on the screen.
                 For example:

                 name = input("Enter your name: ")

                 >>> Enter your name: Ankit
                 The text ‘Ankit’ entered by the user will be stored in the variable name.


                 THE PRINT( ) FUNCTION
                 The print() function is used to display output on the screen in Python. It takes the specified text,
                 variable or value and prints it in the Python shell or terminal.




                                                                                                                  133
                                                                                              Python–Start to Code
   130   131   132   133   134   135   136   137   138   139   140