Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Humpty Dumpty Form by kdim
from math import pi, sqrt, asin, atanh
def checkio(height, width):
a, b = width / 2, height / 2
c = 1 - min(a, b) ** 2 / max(a, b) ** 2
area = 2 * pi * a * a
volume = 2 / 3 * b * area
if a < b:
area *= 1 + b / a / sqrt(c) * asin(sqrt(c))
if a > b:
area *= 1 + (1 - c) / sqrt(c) * atanh(sqrt(c))
if a == b:
area *= 2
return [round(volume, 2), round(area, 2)]
March 28, 2021