Add solutions from problems 9 through 12

This commit is contained in:
lolabird 2024-02-16 17:13:55 -07:00
commit e3b71b9fdb

View file

@ -15,7 +15,21 @@ class Rectangle:
def __str__(self):
return "Lower Left Coordinates: {}; Width: {}; Height: {}".format(self.pos, self.width, self.height)
def area(self):
return self.width * self.height
def perimeter(self):
return self.width * 2 + self.height * 2
r = Rectangle(Point(4, 5), 6, 5)
def transpose(self):
width = self.width
self.width = self.height
self.height = width
return self
r = Rectangle(Point(0, 0), 10, 5)
print(r)
print(r.transpose())