2. Classes and Object 2- Task 1
2. Classes and Object 2- Task 1
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.")
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")