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 David_Jones
from math import asin, atanh, pi
def checkio(height, width):
a, c = width / 2, height / 2
V = (4 / 3) * pi * c * (a ** 2)
if a < c:
e = (1 - a ** 2 / c ** 2) ** .5
S = 2 * pi * a ** 2 * (1 + asin(e) * c / (a * e))
elif a > c:
e = (1 - c ** 2 / a ** 2) ** .5
S = 2 * pi * a ** 2 * (1 + atanh(e) * (1 - e ** 2) / e)
else:
S = 4 * pi * a ** 2
return [round(V, 2), round(S, 2)]
May 16, 2019