Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
meh solution in Clear category for Building Base by Leonix
class Building(object):
def __init__(self, south, west, width_WE, width_NS, height=10):
self.s, self.w, self.h = south, west, height
self.n = south + width_NS
self.e = west + width_WE
def corners(self):
return { "north-west": [self.n, self.w],
"north-east": [self.n, self.e],
"south-west": [self.s, self.w],
"south-east": [self.s, self.e] }
def area(self):
return abs((self.s - self.n)*(self.e - self.w))
def volume(self):
return self.h * self.area()
def __repr__(self):
return f"Building({self.s}, {self.w}, {abs(self.w - self.e)}, {abs(self.s - self.n)}, {self.h})"
June 27, 2019