Python program to enter length and breadth of a rectangle and find its perimeter
ADVERTISEMENTS
Python program to enter the length and breadth of a rectangle and find its perimeter.
There are you will learn how to find the perimeter of a rectangle in Python language.
Formula:
P = 2(l + w)
where:
P
= perimeter
l
= length of the rectangle
w
= width of the rectangle
Let us understand this through the Python program:
# Python program to find the perimeter of a rectangle
print("Enter the length & width of the rectangle::\n")
l, w, p = float(input()), float(input()), None
# Calculate perimeter of rectangle
p = 2 * (l + w)
print("\nThe Perimeter of rectangle = ", p, "units")
Output:
Enter the length & width of the rectangle::
5
7
The perimeter of rectangle = 24.0 units