Computer Science, asked by Rahul33366835, 11 months ago

Write a user defindd func to find area of any 3 shape of your size. Make it presentable. Answer fast ! No wrong plz. Don't do for marks

Answers

Answered by manavjaison
1

Heya friend !!!

Here we go,

           SOURCE CODE (@Manav_Jaison)

print('This program is only for the areas of 3 shapes : square, circle and rectangle')

print()

x=input('choose from any of these 3 shapes:')

if x == 'circle':

   def func1(r):

       area=(22/7)*(r**2)

       return area

   r=float(input('radius:'))

   c=func1(r)

   print(c)

elif x == 'rectangle':

   def func2(l, b):

       area=l * b

       return area

   l = float(input('length:'))

   b = float(input('breadth:'))

   c=func2(l,b)

   print(c)

elif x == 'square':

   def func3(s):

       area=s*s

       return area

   s = float(input('enter side of square:'))

   c=func3(s)

   print(c)

else:

   print('Invalid figure')

   

                            OUTPUT

This program is only for the areas of 3 shapes : square, circle and rectangle

choose from any of these 3 shapes:circle

radius:7

154.0

>>>  

This program is only for the areas of 3 shapes : square, circle and rectangle

choose from any of these 3 shapes:rectangle

length:7

breadth:7

49.0

>>>  

>>>  

This program is only for the areas of 3 shapes : square, circle and rectangle

choose from any of these 3 shapes:square

enter side of square:5

25.0

>>>  

>>>  

This program is only for the areas of 3 shapes : square, circle and rectangle

choose from any of these 3 shapes:triangle

Invalid figure

>>>

Thank You !

#BAL #answerwithquality

@Manav_Jaison

Similar questions