Guest User

Untitled

a guest
Jun 18th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. """
  2.  
  3. Write definitions for these functions:
  4. sphereArea(radius) Returns the surface area of a sphere having the given radius.
  5. sphereVolume(radius) Returns the volume of a sphere having the given radius.
  6. Use your functions to solve Programming Exercise 1 from Chapter 3.
  7.  
  8. """
  9.  
  10. import math
  11.  
  12. def sphere_Area(radius):
  13.  
  14. A = 4 * math.pi * radius ** 2
  15.  
  16. return A
  17.  
  18. def sphere_Volume(radius):
  19.  
  20. V = 4/3 * math.pi * radius ** 3
  21.  
  22. return V
  23.  
  24. def main():
  25.  
  26. radius = eval(input("Enter the radius: "))
  27.  
  28. A = sphere_Area(radius)
  29. V = sphere_Volume(radius) # Define user defined functions in main
  30.  
  31. print("Area of the Sphere is: ",round(A,2))
  32.  
  33. print("Volume of the Sphere is: ",round(V,2))
  34.  
  35.  
  36. main()
Add Comment
Please, Sign In to add comment