Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Building Base by TovarischZhukov
class Building:
def __init__(self, south, west, width_we, width_ns, heihgt=10):
self.south = south
self.west = west
self.width_we = width_we
self.width_ns = width_ns
self.heihgt = heihgt
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.heihgt
def __repr__(self):
return "Building(%s, %s, %s, %s, %s)" % (str(self.south), str(self.west), str(self.width_we), str(self.width_ns), str(self.heihgt))
Dec. 3, 2015