Multilevel inheritance in python

 class dad:

    basketball = 1



class son(dad):
    basketball = 3
    dance = 1
    def isdance(self):
        return f"Yes I dance {self.dance} no of times"



class Grandson(son):
    dance = 5
    # def isdance(self):
    #     return F"Jackson yeah! Yes I dance very awesomely {self.dance} no of times"

darry = dad()
larry = son()
narry = Grandson()
print(darry.basketball)

Comments