QuesAns Print Page – CSKC
Sign In

Search

siteicon
Q&A CBSE12A-2015-B01E #6345

Question:

Find and write the output of the following python code:

class Emp:
    def __init__(self,code,nm): #constructor
        self.Code=code
        self.Name=nm
    def Manip (self) :
        self.Code=self.Code+10
        self.Name='Karan'
    def Show(self,line):
        print self.Code,self.Name,line
s=Emp(25,'Mamta')
s.Show(1)
s.Manip()
s.Show(2)
print s.Code+len(s.Name)

Answer:

25 Mamta 1
35 Karan 2
40