Page 419 - Ai_417_V3.0_C9_Flipbook
P. 419

12.  While loop is also called ………………………. loop.
                    13.  List is a collection of ………………………. data arranged in a sequence.

                    14.  List is a ………………………. data type in Python.

                    15.  The index number begins with 0 till length-1 in ………………………..

                 C.  State whether these statements are true or false.
                    1.  Understanding the problem is the last step in computer problem-solving.                   ……….……

                    2.  The append( ) function appends a single element with the given value(any datatype) at the end of the list.   ……….……
                    3.  Flowcharts are difficult to maintain for complex programs.                                ……….……
                    4.  A block is identified by using an indentation (minimum of 1 space).                       ……….……

                    5.  Algorithms are just a waste of time before writing a code.                                ……….……
                    6.  The rectangle symbol is used to start and end a flowchart.                                ……….……

                    7.  Indentation is not important in conditional programming.                                  ……….……
                    8.  The * operator is used to replicate a list by a specific number of times.                 ……….……
                    9.  For loop is used to give conditions and executes only once.                               ……….……

                    10.  If the condition is True then the block of statement written for True will be executed.     ……….……
                    11.  The count( ) returns the index number of the value given in the function.                ……….……

                    12.  Slicing a list means accessing a specific portion of a list.                             ……….……
                    13.  The index() function return TypeError exception if the value is not found in the list.   ……….……

                    14.  We cannot create an empty list.                                                          ……….……
                    15.  A list can be created within another list.                                               ……….……

                 D.  Find the errors in the given code and write the correct code:
                    1.  a = input("enter a number)

                   Ans.  a = input("enter a number")
                    2.  b + c = a

                   Ans.  a = b + c
                    3.  print("hello"+ Friends")

                   Ans.  print("hello" + "Friends")
                    4.  marks==total/2
                   Ans.  marks=total/2
                    5.  a=input(int("enter marks"))

                   Ans.  a=int(input("enter marks"))
                    6.  num#1 = 100
                       if (num == 100)
                           print (Number is: num
                       print ("Thanks!")
                   Ans.  Correct code is:
                       num = 100



                                                                                        Introduction to Python  417
   414   415   416   417   418   419   420   421   422   423   424