Q. Write a program to calculate the volume and area of a sphere inside separate modules and import them in one complete package.


Volume = 4/3πr3

Surface Area = 4πr2


Answer =


def  vol(r):
    return 4/3( 3.14* r **3)

def  area(r):
    return 4( 3.14* r**2)

 
Let module name is ‘sphere’.
Let package name is ‘pathwala’

Then it can import like:-

>>>import pathwala.sphere as a
>>>a.area(4)

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post