Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Time For a Walk solution in Clear category for Building Base by bafflepitch
class Building:
def __init__(self, south, west, width_WE, width_NS, height=10):
self.south = south
self.west = west
self.width_WE = width_WE
self.width_NS = width_NS
self.height = height
self.north = self.south + self.width_NS
self.east = self.west + self.width_WE
def corners(self):
return {
'north-east':[self.north, self.east],
'south-east':[self.south, self.east],
'south-west':[self.south, self.west],
'north-west':[self.north, self.west]
}
def area(self):
return self.width_NS * self.width_WE
def volume(self):
return self.width_NS * self.width_WE * self.height
def __repr__(self):
return "Building({}, {}, {}, {}, {})".format(
self.south,
self.west,
self.width_WE,
self.width_NS,
self.height)
May 23, 2016