Page 92 - Modular v1.1 Pyhton
P. 92

Computational Thinking

                  F.  What will be the output of the following programs?
                      1.   tuple1=(3, 4, 6, 7)           2.     tup1 = ('sst', 'chemistry', 2010, 2022);
                           print(tuple1)                        tup2 = (1, 2, 3, 4, 5 );
                                                                print ("tup1[0]: ", tup1[0])
                                                                print ("tup2[1:5]:", tup2[1:5])

                      3.   checks = (10, 20, 30)           4.   friends = ("Prakash", "Gurcharan", "Ajay",
                           # Multiply tuple                     "Sanjay")
                           total = checks * 3                   print(max(friends))
                           print(total)                         print(min(friends))

                                                                earnings = (5000, 7020, 400, 800)
                                                                print(max(earnings))
                                                                print(min(earnings))




                                                    In the lab                                Computational Thinking


                     1.  Write a program that uses max( ) function to get maximum value in tuples.

                     2.  Write a Python program to display all the elements of the given tuple (tup= ('o', 'r', 'a',
                         'n', 'g', 'e')) except 'a' and 'e'.







                   Teacher's Corner

                  1.   Discuss with students how tuple in Python is immutable?
                  2.   A tuple is constructed by enclosing a series of comma-separated items in square brackets. Is it True or False?
                      Discuss it with students.































                   90     Touchpad MODULAR (Version 1.0)
   87   88   89   90   91   92   93   94   95   96   97