Page 140 - TP_Play_V2.2_Class8
P. 140

6.   What is the purpose of using max(list) and min(list) functions? Give examples.






                                                                                                     21 st
                     Scratch Your Brain                                                           Century   #Critical Thinking
                                                                                                    Skills

                      1.  What will be the output of the following programs?
                         a.  list1=[13, 25, 41, 63, 82]


                           list1[1]=50

                           list1[3]=45

                           print(list1[:])
                         b.  list1=[13, 25, 41, 63, 82]

                           list1.append(19)

                           print(list1)

                         c.  list1=[13, 25, 41, 63, 82]

                           list1.insert(1, 302)

                           print(list1)

                         d.  list1=[13, 25, 41, 63, 82]

                           list2=[14, 26, 42, 64]
                           print(len(list1))

                           print(max(list2))

                           print(min(list1))
                         e.  list1=[13, 25, 41, 63, 82]

                           print(list1[4])
                      2.   Find errors in the code given below.
                         a.  new_list = ['a';'b';'c';'d';'e']


                           print(new_list[-1]):

                           print(new_list:[-5])

                         b. my_list = ['o','r','a','n','g','e'];


                           print(my_list[2;5])

                           print(my_list[5:]):
                           print(my_list[::])




                  138  Plus (Ver. 4.0)-VIII
   135   136   137   138   139   140   141   142   143   144   145