Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
three functions solution in Clear category for Simple Areas by Olpag
from math import pi
def simple_areas(*args):
circle = lambda args: round(pi*(args[0]/2)**2, 2)
rectangle = lambda args: round(args[0]*args[1], 2)
def triangle(args):
p, a, b, c = sum(args)/2, *args
return round((p*(p-a)*(p-b)*(p-c))**0.5, 2)
return circle(args) if len(args) ==1 else rectangle(args) if len(args) ==2 else triangle(args)
Sept. 16, 2019
Comments: