Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Humpty Dumpty Form by TovarischZhukov
import math
def checkio(h, w):
b = w/2.0
a = h/2.0
if h > w:
e = (a**2-b**2)**0.5/float(a)
s = round(2*math.pi*b*(b+a*math.asin(e)/e), 2)
elif h< w:
e = (b**2-a**2)**0.5/float(a)
s = round(2*math.pi*b*(b+a*math.log(b/a+e)/e), 2)
else:
a = b = r = w/2.0
s = round(math.pi*r**2*4,2)
c = b
v = round((4/3.0)*math.pi*a*b*c,2)
return [v, s]
Dec. 19, 2015