0

How to fix this? PTHYON

class Shape: def __init__(self, w, h): self.width = w self.height = h def area(self): return self.width*self.height def add(self ,other): return Shape(self.width+other.width,self.height+other.height) def gt(self ,other): return self.area() > other.area() w1 = int(input()) h1 = int(input()) w2 = int(input()) h2 = int(input()) s1 = Shape(w1, h1) s2 = Shape(w2, h2) result = s1 + s2 print(result.area()) print(s1 > s2)

3rd Mar 2022, 2:44 AM
Bluegray
Bluegray - avatar
1 Odpowiedź
+ 2
replace "result = s1 + s2" with "result = s1.add(s2)" and "print(s1 > s2)" with "print(s1.area() + s2.area())" https://code.sololearn.com/ckq2b13LDj8g/?ref=app
3rd Mar 2022, 3:18 AM
Abhay
Abhay - avatar