find area of rectangle program in python

In this example, you will find area of rectangle by user entered width and height.

This program for Area of a rectangle allows the user to enter width and height of the rectangle. Using those values, this python program will calculate the Area of a rectangle and perimeter of a rectangle.

Example :

# Python program to find the area of Rectangle
w = float(input('Please Enter the Width of a Rectangle: '))
h = float(input('Please Enter the Height of a Rectangle: '))
# calculate the area
Area = w * h
# calculate the Perimeter
Perimeter = 2 * (w + h)
print("Area of a Rectangle is: %.2f" %Area)
print("Perimeter of Rectangle is: %.2f" %Perimeter)

Output :

Please Enter the Width of a Rectangle: 12
Please Enter the Height of a Rectangle: 15
Area of a Rectangle is: 180.00
Perimeter of Rectangle is: 54.00

Explanation :

First of all, program will ask user to input height and width. Then perform calculate and store answer into differant variable and print area and perimeter of rectangle.

Share your thoughts

Ask anything about this examples