Page 80 - Code & Click - 8
P. 80

2. Press the F5 key to execute the code. Sample output of the program is given below.




















             Post-Processingost-Processing
             P
               A Function is a code block that has a name, performs a specific task, and can be reused
                  anywhere in a program.
                A Python function has four basic components – function name, arguments, body of function,
                  and return expression.

                The Python built-in functions have their functionality is predefined in Python.
                A function created by the user for performing a specific task is called a User-defined function.
                A List is a special type of variable that acts like a container and can store multiple values in
                  it, enclosed within brackets ([ ]).




                                                        Info Retention

            A.   Select the correct option for each of the following statements.
                1.  Which type of functions are available in Python as standard functions?
                    (a)  User defined       (b)  Built-in             (c)  Public-defined     (d)  Private

                2.  Which keyword is used to create a user-defined function?
                    (a)  Create             (b)  Define               (c)  Def                (d)  Call

                3.  How many values can be returned by a return statement?
                    (a)  One                (b)  Two                  (c)  None               (d)  Infinite

            B.  Fill in the blanks with the correct answer.

                1.  A named block of instructions that can be executed using its name is called _________.
                2.  The functions provided by Python are called _________.

                3.  The values given to a function as input are called _________.

            C.  Write ‘T’ for True and ‘F’ for False statement.
                1.  A function, once defined, can be called only once in a program.                        _______

                2.  The len( ) function returns the length of a string.                                    _______
                3.  range( ) is an example of a user-defined function.                                     _______


            78
   75   76   77   78   79   80   81   82   83   84   85