Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Straightforward solution in Clear category for Simple Areas by nickie
from math import pi, sqrt
def simple_areas(a, b=None, c=None):
if c: # triangle, use Heron's formula
p = (a+b+c)/2
return sqrt(p*(p-a)*(p-b)*(p-c))
if b: # rectangle
return a*b
else: # circle
return pi*(a/2)**2
May 19, 2014
Comments: