Page 135 - Trackpad_V1_Book 8_Flipbook
P. 135

REVISIT


                   ▶     A consecutive sequence of characters that are enclosed or surrounded by single (‘ ’) or double (“ ”) quotes
                      is known as a string.
                   ▶     A list is a type of container that is used to store a list of values of any type.
                   ▶     Functions help us break our program into smaller pieces or modules.
                   ▶     Python functions can be categorised into in-built functions and user-defined functions.












                 1.   Tick ( ) the correct option.

                     a.   Which type of function is append( )?
                           (i)  Built-in                                  (ii)  User-defined

                          (iii)  Not a valid function                     (iv)  None of these
                     b.   What is the input given to the functions referred to as?
                           (i)  Return Value                              (ii)  Name

                          (iii)  Arguments                                (iv)  None of these
                     c.   Which user-defined function takes parameters and returns output?
                           (i)  type1                                     (ii)  type2

                          (iii)  type3                                    (iv)  None of these
                     d.   Which of the following is used to insert special characters that are invalid in Python?

                           (i)  Escape sequence                           (ii)  Strings
                          (iii)  Lists                                    (iv)  None of these
                     e.   Which operator is used to repeat the string for a given number of times?

                           (i)  String Concatenation Operator             (ii)  String Replication Operator
                          (iii)  len()                                    (iv)  None of these

                 2.  Fill in the blanks using the words from the help box.

                                                 Function, append, string, lower


                     a.     The _______________ function inserts the object passed to it at the end of the list.

                     b.   _______________ can be defined as a block of reusable code that performs a specific task.
                     c.     The _______________ function converts all uppercase letters to lowercase.

                     d.    A consecutive sequence of characters that is enclosed or surrounded by single or double quotes
                          is known as a _______________ .



                                                                                   Functions, String and List in Python  133
   130   131   132   133   134   135   136   137   138   139   140