0
Attribute error in multiple inheritance using Python
I'm facing Attribute Error in multiple inheritance program to calculate total cost of painting a room. Room(area) cost of painting(per meter square) \ / total cost of painting Formula : area = 2lb+2bh+2hl input: l=5 b=5 h=5 cost (per metersquare) = 50 output: 7500 Here is the code I have written pls fix the error And give the solution https://code.sololearn.com/cwsghPJqYQjX Thank you
2 Respuestas
0
You could try something like this
class Room:
def __init__(self):
self.l=int(input("enter length of room != "))
self.b= int(input("enter breath of room = "))
self.h =int(input("enter height of room = "))
def area(self):
a = 2*(self.l * self.b)+2*(self.h * self.b)+2*(self.h * self.l)
return a
class Paint:
def __init__(self):
self.amt = int(input("enter cost per meter square = "))
class Cost():
def totalcost(self):
c = Room().area() * Paint().amt
print("total cost to paint a room = ",c)
def area(self):
return Room().area()
c1 = Cost()
0
thank you for the response but @Achn371 this code is about multiple inheritance.....