Monday, 24 January 2022

Define a class named Rectangle which can be constructed by a length and width. The Rectangle class has a method which can compute the area and Perimeter

Slip 21 Q 1

CODE:


class Ractangle():
    def __init__(self,l,w):
        self.l=l
        self.w=w
    def rectangle_area(self):
        return self.l*self.w
    def rectangle_Perimeter(self):
        return (self.l*2)+(self.w*2)
   
L=int(input('enter Length  of Rectangle :'))
W=int(input('enter Width  of Rectangle :'))
a1=Ractangle(L,W)
print(a1.rectangle_area())
print(a1.rectangle_Perimeter())


OUTPUT:



No comments:

Post a Comment

Write a Java program to display given extension files from a specific directory on server machine.

 DOWNLOAD     SLIP14Q2 /** * STEPS TO RUN CODE * Step 01 compile the code * Step 02 run the code * Step 03 give a file directory locatio...