'''
Adriana Picoral
CSC110
Class Demonstration
This program has two functions: one to calculate the area of a sphere,
the other to calculate the volume of a sphere.
The main() function is called to print to the standard output the
area and volume of a sphere of radius .75
'''
def sphere_volume(radius):
'''
This function calculates the volume of a sphere of given radius.
Args:
radius: integer representing the radius of the sphere
Returns:
The float representing the volume of a sphere of the given radius
'''
volume = (1 / 3) * sphere_area(radius) * radius
return round(volume, 2)
def sphere_area(radius):
'''
This function calculates the area of a sphere of given radius.
Args:
radius: integer representing the radius of the sphere
Returns:
The float representing the area of a sphere of the given radius
'''
area = 4 * 3.1415 * radius**2
return round(area, 2)
def main():
'''
This function prints the volume and area of a sphere of radius .75.
Args:
None
Returns:
None
'''
r = .75
v = sphere_volume(r)
a = sphere_area(r)
print(v, a)
main()
1.77 7.07