201k views
2 votes
For python, Write a function named getResults that accepts radius of a sphere and returns the volume and surface area. Call this function with radius = 3.5 , and display results in one decimal format.

volume = 4/3 * pi * r ^ 3
Surface Area = 4pi * r ^ 2

1 Answer

2 votes

import math

def getResults(r):

return "Volume = {}\\Surface Area = {}".format(round((4/3)*math.pi*(r**3),1), round((4*math.pi)*(r**2),1))

print(getResults(3.5))

I hope this helps!

User Richi
by
6.2k points