42.4k views
7 votes
The volume of a sphere is 4/3πr3, where π has the value of "pi". Write a function called print_volume (r) that takes an argument for the radius of the sphere, and prints the volume of the sphere.

Call your print_volume function three times with different values for radius.

User Jameson
by
4.6k points

1 Answer

4 votes

Answer:

In Python:

def print_volume (r):

volume = 4/3 * 3.142*r**3

print(volume)

print_volume(7)

print_volume(14)

print_volume(22)

Step-by-step explanation:

This defines the function and takes radius r as the parameter

def print_volume (r):

This calculates the volume

volume = 4/3 * 3.142*r**3

This prints the volume

print(volume)

The next three lines call the function with different values

print_volume(7)

print_volume(14)

print_volume(22)

User Max Vorobjev
by
4.9k points