Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Simple Areas by Moff
from math import pi, sqrt
def simple_areas(*args):
if len(args) == 1:
d = args[0]
return round(pi * d * d / 4, 2)
elif len(args) == 2:
a, b = args
return a * b
elif len(args) == 3:
a, b, c = args
p = (a + b + c) / 2
return round(sqrt(p * (p - a) * (p - b) * (p - c)), 2)
else:
return 0
July 24, 2015