Introduction:
Learn how to calculate the area of a rectangle with Python! Our code example shows you how to find the area by multiplying the length with the breadth. See the result for a given length of 10 and breadth of 20. Start mastering rectangle area calculations now!”
Code:
length = 10
breadth = 20
area = length * breadth
print(area)
Logic:
- Assign the value 10 to the variable “length” to represent the length of the rectangle.
- Assign the value 20 to the variable “breadth” to represent the breadth (width) of the rectangle.
- Calculate the area of the rectangle by multiplying the values of “length” and “breadth” and store the result in the variable “area.”
- Print the calculated area using the “print” function.
Output:
In summary, the code calculates the area of a rectangle with a length of 10 and breadth of 20 and displays the result, which would be 200.
>> 200