0% found this document useful (0 votes)
10 views

Python Oops 2-2

Uploaded by

Mani Kanta
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)
10 views

Python Oops 2-2

Uploaded by

Mani Kanta
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/ 1

class rectangle:

def display (self):


print("This is a Rectangle")
def area(self,length, breadth):
a = length * breadth
print("Area of Rectangle is ",a)
class square:
def display(self):
print("This is a Square")
def area(self,side):
A = side*side
print("Area of square is ",A)

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

class parent:
def __init__(self,totalasset):
self.totalasset = totalasset
def display(self):
print("Total Asset Worth is "+str(self.totalasset)+" Million.")
print("Share of Parents is "+str(round(self.totalasset/2,2))+" Million.")

class son(parent):
def __init__(self, total, val):
parent. __init__(self,total)
self.ps = total * val/100
def son_display(self):
print("Share of Son is {} Million.".format(round(self.ps,2)))
class daughter(parent):
def __init__(self, total, val):
parent. __init__(self,total)
self.pd = total*val/100
def daughter_display(self):
print("Share of Daughter is {} Million.".format(round(self.pd,2)))

You might also like