Posts

Showing posts from August 10, 2021

Single Inheritance, multiple inheritance and multilevel inheritance in python.

Multilevel inheritance in python  A program as an example. Code - -------------------------------- class ElectronicDevice:     refrigerator = 1000     def __init__(self, name, watt):         self.name = name         self.watt = watt     def rupee_checker(self):         a = 283         if self.watt < 1000:             return f"Your Electrical Device consumes less than {a} units per year."         elif self.watt > 1000:             return f"Your Electrical Device consumes more than {a} units per year."         elif self.watt == 1000:             return f"Your Electrical Device consumes {a} units per year." class PocketGadget(ElectronicDevice):     MaH = 3000     def __init__(self, name, mah):         se...