0

So the problem is to define these six functions

def sphereVolume(r):
def sphereSurface(r):
def cylinderVolume(r,h):
def cylinderSurface(r,h):
def coneVolume(r,h):
def coneSurface(r,h):

And the write a program that prompts the user for the values of r and h, call the six functions, and print the results.

I have not tested this code because I am on a computer currently that does not have scite or python, however I've created this code on a notepad.

from math import pi
def sphereVolume():
    volume1=((4/3)*pi*r)**3))
    return volume1


def sphereSurface():
    area1=(4*pi*r**2)
    return area1


def cylinderVolume():
    volume2=(pi*r**2*h)
    return volume2

def cylinderSurface():
    area2=(2*pi*r**2+2*pi*r*h)
    return area2

def coneVolume():
    volume3=((1/3)*pi*r**2*h)
    return volume3

def coneSurface():
    area3=(pi*r+pi*r**2)
    return area3

main():




def main():
    r=int (input("Enter the radius:"))
    h=int (input("Enter the heights:"))
    print ("Sphere volume:",sphereVolume(r),volume1)
    print ("Sphere Surface:",sphereSurface(r),area1)
    print ("Cylinder Volume:" , cylinderVolume(r,h),volume2)
    print ("Cylinder Surface:",cylinderSurface(r,h),area2)
    print ("Cone Volume:",coneVolume(r,h),volume3)
    print ("Cone Surface:",coneSurface(r,h),area3)

Am I using the functions properly? Or is there a lot that I need to change?

4

2 に答える 2

0

と の関数に引数を追加する必要がありrますh

次の追加の親があります。

volume1=((4/3)*pi*r)**3))

修正する必要があります:

main():
于 2013-10-09T01:45:15.783 に答える