what is parallelogram ? :
A four-sided plane rectilinear figure with opposite sides parallel.
Types of parallelogram :
- Rectangle
- Rhombus
- Square
Formula to calculate Area of parallelogram :
Let's Suppose a and b are the set of parallel sides of a parallelogram and h is the height of parallelogram, then based on the length of sides and height of it, the formula for its area is :
Area = Base × Height
A = b × h [sq.unit]
Python program to calculate the area of a parallelogram :
l =float(input("Enter base/length of the parallelogram : "))h =float(input("Enter height of the parallelogram : "))area = l*hprint("The area of given parallelogram is : ", area)
Output :
Explanation of above code:
l =float(input("Enter base/length of the parallelogram : "))
h =float(input("Enter height of the parallelogram : "))
Here, l and h is variable that store a decimal value in which l store the value of base/lenght of the parallelogram and h store the value of height of the parallelogram.
area = l*h
then, area (variable ) store an expression (formula) that store the area of a parallelogram.
print("The area of given parallelogram is : ", area)
At last we print the area of the parallelogram.
User tasks :-
How to calculate parimeter of parallelogram in python ?
0 Comments