0% found this document useful (0 votes)
8 views2 pages

Class Test

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Class Test

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

class Test:

def show(self):
print("Show")

t1=Test()
t1.show()

======================================

class Tree:
def mango(self):
print("mango tree")
def banana(self):
print("Banana tree")
def papaya(self):
print("Papaya tree")

t1=Tree()
t1.mango()
t1.banana()
t1.papaya()

=============================================
find the sum of two no
class sum:
def add(self):
a=100
b=200
c=a+b
print("sum=",c)

t1=sum()
t1.add()
================================================

class sum:
def read(self,a,b):
self.a=a
self.b=b
def cal(self):
c=self.a+self.b
print("sum",c)

t1=sum()
t1.read(10,20)
t1.cal()

===================================================

class sum:
def read(self,a,b):
self.a=a
self.b=b
def cal(self):
self.c=self.a+self.b
def show(self):
print("sum",self.c)
t1=sum()
t1.read(10,20)
t1.cal()
t1.show()

======================================================
class sum:
def __init__(self,a,b):
self.a=a
self.b=b
def cal(self):
self.c=self.a+self.b
def show(self):
print("sum",self.c)

t1=sum(10,20)
t1.cal()
t1.show()

======================================================

class student:
def getdata(self,roll,name,fee):
self.roll=roll
self.name=name
self.fee=fee
def showdata(self):
print("Roll : ",self.roll)
print("Name : ",self.name)
print("fee : ",self.fee)

s1=student()
s1.getdata(1001,"ashok",3000)
s1.showdata()

=========================================

You might also like