Page 86 - Code & Click - 6
P. 86

Python allows two types of comments in programs. These are:

               •  Single-line comments: Single-line comments are preceded by the hash (#) symbol.
               •  Multi-line comments: Multi-line comments that cover more than one line are enclosed within
                  triple quotes (“““ ”””).
                  For example,

                  # This is a single-line comment.            “““ This is a comment
                                                              that covers multiple lines”””
             P
             Post-Processingost-Processing
                Python is a high-level language used for writing computer programs.
                Script mode and Interactive mode (shell mode) are the two modes used for writing Python code.
                Only one command can be executed at a time in interactive mode.

                Script mode is used for writing computer program.
                Python files are saved with .py extension.
                Print( ) function is used to display output on the screen.



                                                        Info Retention

            A.  Select the correct option for each of the following statements.
                1.  In the ______ mode, commands are typed at the command prompt one by one.

                    (a)  Script             (b)  Shell                (c)  Command            (d)  Interactive
                2.  Which of these is a Python command prompt?

                    (a)  >>>                (b)  &&&                  (c)  <<<                (d)  ###

                3.  The extension of Python program files is ______.
                    (a)  .python            (b)  .py                  (c)  .pyt               (d)  .shell

                4.  The key used to execute a python program is ______.
                    (a)  F4                 (b)  F5                   (c)  F6                 (d)  Ctrl + R

            B.  Fill in the blanks with the correct answer.

                1.  Interactive mode is also known as _________ mode.
                2.  Single-line comments in Python are indicated by the _________ symbol.

                3.  The _________ function is used to get data from the user and store it in a variable.
                4.  The _________ mode is also known as Batch processing mode.


            C.   Write ‘T’ for True and ‘F’ for False statement.
                1.  Python is an interpreted language.                                                     _______

                2.  Python is used for programming robots or developing AI applications.                   _______
                3.  IDLE stands for Integrated Development and Learning Education.                         _______

                4.  Variable names must start with underscore.                                             _______


            84
   81   82   83   84   85   86   87   88   89   90   91