QuesAns Print Page – CSKC
Sign In

Search

siteicon
Q&A CBSE12A-2017-B01E #6221

Question:

Find and write the output of the following python code:

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
I1=INVENTORY()
I2=INVENTORY(105,"Thumb Pin",50)
I3=INVENTORY(102,"U Clip")
I1.Procure(25)
I2.Issue(15)
I3.Procure(50)
I1.Status()
I3.Status()
I2.Status()

Answer:

Output
101 : Pad # 125
102 : U Clip # 150
105 : Thumb Pin # 35