find the area of a parallelogram in python

To find the area of a parallelogram in python, you can use the following formula:

area = base * height

where base is the length of the base of the parallelogram and height is the perpendicular distance between the base and the opposite side of the parallelogram.

Here's a python code snippet that calculates the area of a parallelogram:

main.py
base = 10
height = 5
area = base * height
print("The area of the parallelogram is:", area)
91 chars
5 lines

Output:

main.py
The area of the parallelogram is: 50
37 chars
2 lines

In this example, we assume that the base of the parallelogram is 10 units long and the height is 5 units long. The program outputs the area of the parallelogram which is 50 square units.

gistlibby LogSnag