编写一个python程序来计算半径为r的球体、半径为r、高度为h的圆柱、底部为半径为r、高度为h的圆锥体的体积和表面积。将它们放入几何模块中。然后编写一个程序,提示用户输入r和h的值,调用这六个函数,并打印结果。在
这是我的密码from math import sqrt
from math import pi
# FUNCTIONS
def sphere_volume(radius):
return 4/3 * pi * (radius ** 3)
def sphere_surface(radius):
return 4 * pi * radius ** 2
def cylinder_volume(radius, height):
return pi * radius ** 2
def cylinder_surface(radius, height):
return pi * radius ** 2 * 2 * pi * radius * height
def cone_volume(radius, height):
return 1/3 * pi * radius ** 2 * height
def cone_surface(radius, height):
return pi * radius ** 2 + pi * radius * sqrt(height ** 2 + radius ** 2)
# main
def main():
radius = input("Radius>")
height = input("Height>")
print("Sphere volume: %d" %(sphere_volume(radius)))
print("Sphere surface: %