Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
__init__ = choose_figure solution in Creative category for Geometry Figures by flpo
class Parameters:
__init__ = choose_figure = lambda s, a: setattr(s, 'fp'[type(a) in (int, float)], a)
__getattr__ = lambda s, i: lambda: round(getattr(s.f, i)(s.p), 2)
class RegularPoly:
area, perimeter, volume = lambda s, p: p ** 2 * s.p, lambda s, p: s.n * p, lambda *_: 0
class Circle(RegularPoly): n, p = 6.283185307179586, 3.141592653589793
class Triangle(RegularPoly): n, p = 3, 0.43301
class Square(RegularPoly): n, p = 4, 1
class Pentagon(RegularPoly): n, p = 5, 1.72048
class Hexagon(RegularPoly): n, p = 6, 2.598076211
class Cube(RegularPoly): n, p, volume = 12, 6, 3..__rpow__
June 23, 2018