Answer to Question #237596 in Python for Joel

Question #237596

Write a function called print_voluma (r) that takes an argument for radius of the sphere, and prints the volume of the sphere .

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


Include all the following in your learning Journal :

· The code for your print_volume function.

·The inputs and outputs of three calls of your print_volume


1
Expert's answer
2021-09-17T20:57:53-0400
import math
_pi = math.pi


def print_volume (rad):
    res = (4 / 3) * _pi * (rad * rad *rad)
    return res


print("volume of the sphere (radius=7) = ",print_volume(7))
print("volume of the sphere (radius=14) = ",print_volume(14))
print("volume of the sphere (radius=21) = ",print_volume(21))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS