Classwork:
Re-write the circle calculator program to use functions and add two more functions: sphereVolume
This function must:
calculate the volume of the sphere
print volume with a message
The other function, sphereSurfArea must:
calculate the surface area of the sphere
print the surface area with a message
calculate the surface area of the sphere
print the surface area with a message
#####################################
# Functions
#####################################
def getRadius():
# prompt the user for radius
radius = float(input(“What is the radius?”))
print(“The circumference is “, 2 * pi * radius)
return radius
def sphereVolume(radius):
# calculate the volume of the sphere
# print volume with a message
def sphereSurfArea(radius):
# calculate the area of the sphere
# print area with a message
#####################################
# Driver: control the flow of execution
#####################################
#
# main
#
#
radius = getRadius()
sphereSurfArea(radius)
sphereVolume(radius)
NOTE
import math # on first line
piVariable = math.pi