class son(parent):
def __init__(self,total,Percentage_for_son):
self.Percentage_for_son=Percentage_for_son
parent.total_asset=total
def son_display(self):
self.sp=self.Percentage_for_son*parent.total_asset/100
print("Share of Son is "+str(self.sp)+" Million.")
class daughter(parent):
def __init__(self,total,Percentage_for_daughter):
parent.total_asset=total
self.Percentage_for_daughter=Percentage_for_daughter
def daughter_display(self):
self.dp=self.Percentage_for_daughter*parent.total_asset/100
print("Share of Daughter is "+str(self.dp)+" Million.")
####################### TASK 2# ##########################
class rectangle():
def display(self):
print("This is a Rectangle")
def area(self,l,b):
self.l=l
self.b=b
self.area=self.l*self.b
print("Area of Rectangle is {}".format(self.area))
class square():
def display(self):
print("This is a Square")
def area(self,s):
self.s=s
self.area=self.s*self.s
print("Area of square is {}".format(self.area))
if(installment>3):
raise ValueError("Maximum Permitted Number of Installments is 3")
elif(installment==0):
raise ZeroDivisionError("Number of Installments cannot be Zero.")
else:
amount=memberfee/installment
print("Amount per Installment is {}".format(amount))
li=["Philosophers stone","Chamber of Secrets","prisoner of azkaban","Goblet
of Fire","order of phoenix","Half Blood Prince","deathly hallows 1","deathly
hallows 2"]
c=li.count(book)
if(c==0):
print("No such book exists in this section")
else:
print("It is available in this section")
if(c==0):
raise NameError("No such book exists in this section")
else:
print("It is available in this section")