Python Oops 2-2
Python Oops 2-2
=======================================================================
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)))