Question
Write functions - def sphereVolume(r) - def sphereSurface(r) - def cylinderVolume(r, h) - def cylinderSurface(r, h) - def coneVolume(r, h) - def coneSurface(r, h) that compute the volume and surface area of a sphere with a radius r, a cylinder with a circular base with radius r and height h, and a cone with a circular base with radius r and height h. Place them into a geometry module. Then write a program that prompts the user for the values of r and h, calls the six functions, and prints the results.
Solution
VerifiedAnswered 3 months ago
Answered 3 months ago
Step 1
1 of 3# geometry.py
from math import pi, sqrt
class Geometry:
def sphereVolume(r):
return 4/3 * pi * r**3
def sphereSurface(r):
return 4 * pi * r**2
def cylinderVolume(r, h):
return r**2 * pi * h
def cylinderSurface(r, h):
return 2 * r**2 * pi + r**2 * pi * h
def coneVolume(r, h):
return 1/3 * pi * r**2 * h
def coneSurface(r, h):
return pi * r**2 + pi * r * sqrt(h**2 + r**2)
Create an account to view solutions
By signing up, you accept Quizlet's Terms of Service and Privacy Policy
Create an account to view solutions
By signing up, you accept Quizlet's Terms of Service and Privacy Policy
Recommended textbook solutions

Computer Organization and Design MIPS Edition: The Hardware/Software Interface
5th Edition•ISBN: 9780124077263 (7 more)David A. Patterson, John L. Hennessy220 solutions

Fundamentals of Database Systems
7th Edition•ISBN: 9780133970777 (2 more)Ramez Elmasri, Shamkant B. Navathe687 solutions

Introduction to Algorithms
3rd Edition•ISBN: 9780262033848 (3 more)Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen726 solutions

Python for Everyone
2nd Edition•ISBN: 9781119056553 (2 more)Cay S. Horstmann, Rance D. Necaise730 solutions