Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Building Base by Moff
class Building(object):
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
def corners(self):
return {
"north-west": [self.south + self.width_ns, self.west],
"north-east": [self.south + self.width_ns, self.west + self.width_we],
"south-west": [self.south, self.west],
"south-east": [self.south, self.west + self.width_we]}
def area(self):
return self.width_we * self.width_ns
def volume(self):
return self.area() * self.height
def __repr__(self):
return 'Building({0.south}, {0.west}, {0.width_we}, {0.width_ns}, {0.height})'.format(self)
July 29, 2015
Comments: