Python Programs

Python Program To Find Area And Perimeter Of Rectangle

Last updated June 6, 2023 by Jarvis Silva

Want to find the area and perimeter of rectangle using python then you are at the right place, today in this tutorial we will see how to use python to find area and perimeter of rectangle.

A rectangle is a quadrilateral with four right angles so inorder to create this program we will use the below formulas for rectange area and perimeter.

  • Area = length * width
  • Perimeter = 2 (length + width)

Python Code To Find Area And Perimeter Of A Rectangle

length = int(input('Length : '))
width = int(input('Width : '))

area = length * width
perimeter= 2 * (length + width)

print(f'Area of the Rectangle : {area}')
print(f'Perimeter of the Rectangle : {perimeter}')

Above is the code for finding the area and perimeter of a rectangle, It is a very simple program I ask the user for length and width and add them to rectangle area and perimeter formula.

Now to run this program you need python installed on your computer if you don’t have python installed read this guide: Install and setup python or you can use an online python compiler to run this program.

When you run the program it will ask you to enter the length and width of the rectangle, after you enter it will print the area and perimeter of the rectangle, below is an example output:

Length : 10
Width : 5
Area of the Rectangle : 50
Perimeter of the Rectangle : 30

As you can see, it successfully prints the area and perimeter of a rectangle. I hope you were able to run this program successfully.

Here are some more python tutorials you will find helpful:

I hope you found what you were looking for from this python tutorial and if you want more python tutorials like this, do join our Telegram channel for future updates.

Thanks for reading, have a nice day 🙂