B01E-2017 – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Exam Questions-CBSE12D-2017-B01E #PYTHON#6400    siteicon   siteicon  

Problem Statement - B01E-2017

Find and write the output of the following python code:

class ITEM:
    def __init__(self,I=101,N="Pen",Q=10): #constructor
        self.Ino=I
        self.IName=N
        self.Qty=int(Q);
    def Buy(self,Q):
        self.Qty = self.Qty + Q
    def Sell(self,Q):
        self.Qty -= Q
    def ShowStock(self):
        print self.Ino,":",self.IName,"#",self.Qty
I1=ITEM()
I2=ITEM(100,"Eraser",100)
I3=ITEM(102,"Sharpener")
I1.Buy(10)
I2.Sell(25)
I3.Buy(75)
I3.ShowStock()
I1.ShowStock()
I2.ShowStock()

Solution

TC++ #6400

102 : Sharpener # 85
101 : Pen # 20
100 : Eraser # 75


Share

CSKC| Created: 12-Jan-2019 | Updated: 12-Jan-2019|CBSE12D-2017









Back