# area_volume_sphere.py
# This module has two functions in it. The first function calculates the area of a
# sphere. The second function calculates the volume of a sphere.
# by: Scott Gordon
import math
# Create a function to calculate the area of a sphere.
def sphere_area(radius):
area = 4 * math.pi * radius**2
return area
# Create a function to calculate the volume of a sphere.
def sphere_volume(radius):
volume = (4/3) * math.pi * radius**3
return volume
# Run both functions to demonstrate their output.
def main():
print(f"The area of the sphere is {sphere_area(2)}")
print(f"The volume of the sphere is {sphere_volume(3)}")
main()
Photo by Fakurian Design on Unsplash
Top comments (0)