Question

Python Write definitions for these functions: sphereArea(radius) returns the surface area of a sphere having the...

Python

Write definitions for these functions:
sphereArea(radius) returns the surface area of a sphere having the given radius.
sphere Volume (radius). Returns the volume of a sphere having the given radius.

from math import pi

def sphere_area(r):
    """Area of a sphere with radius r."""

    *** YOUR CODE HERE ***

def sphere_volume(r):
    """Volume of a sphere with radius r."""

    *** YOUR CODE HERE ***

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The answer to the question is given below.


The python code is given below.


#import pi from math package
from math import pi

#defination for area of sphere
def sphere_area(r):
return (4*pi*r*r)

#defination for volume of sphere
def sphere_volume(r):
return((4/3)*pi*r*r*r)

#Getting the radius from user
r=float(input("Enter the radius of spehere: "))
#calling the both function and getting the return value in variable area and spehere
area=sphere_area(r)
volume=sphere_volume(r)

#Displaying the area and volume
print("Area of the sphere is : ",area)
print("Volume of the sphere is : ",volume)


The screenshot of the running code is given below.




The screenshot of the input-output is given below.









If the answer helped please upvote it means a lot. For any query please comment.



Add a comment
Know the answer?
Add Answer to:
Python Write definitions for these functions: sphereArea(radius) returns the surface area of a sphere having the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT