Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
len(args) == 1 solution in Clear category for Simple Areas by martin.pilka
def simple_areas(*args):
from math import pi, sqrt
if len(args) == 1:
r = pi*(args[0]/2)**2
elif len(args) == 2:
r = args[0] * args[1]
elif len(args) == 3:
# http://mathworld.wolfram.com/TriangleArea.html
a, b, c = args
r = 1/4 * sqrt((a+b+c) * (b+c-a) * (c+a-b) * (a+b-c))
else:
raise ValueError("Invalid argument")
return r
Feb. 11, 2019