Sunday, 23 January 2022

Write a python script to create a class Rectangle with data member’s length, width and methods area, perimeter which can compute the area and perimeter of rectangle.

Slip 16 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...