Page 282 - C++
P. 282

(b)     Name  the  Python  Library  modules  which  need  to  be  imported  to
                   invoke the following functions :                                                1
                   (i)     floor()
                   (ii)    randint()

           (c)     Rewrite  the  following  code  in  Python  after  removing  all  syntax
                   error(s). Underline each correction done in the code.                           2

                   STRING=""WELCOME
                   NOTE""

                   for S in range[0,8]:
                       print STRING(S)

                   print S+STRING
           (d)     Find and write the output of the following Python code :                        2

                   TXT   = ["20","50","30","40"]
                   CNT   = 3

                   TOTAL = 0
                   for C in [7,5,4,6]:
                       T = TXT[CNT]

                       TOTAL = float (T) + C
                       print TOTAL

                       CNT-=1
           (e)     Find and write the output of the following Python code :                        3

                   class INVENTORY:

                       def __init__(self,C=101,N="Pad",Q=100): #constructor
                           self.Code=C
                           self.IName=N

                           self.Qty=int(Q);
                       def Procure(self,Q):

                           self.Qty = self.Qty + Q
                       def Issue(self,Q):

                           self.Qty -= Q
                       def Status(self):

                           print self.Code,":",self.IName,"#",self.Qty
      91                                            12
   277   278   279   280   281   282   283   284   285   286   287