Learn about Find the Area of a Rectangle in Python in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.
Contents
Find the Area of a Rectangle in Python
# Program to find area of rectangle from user input
# inputs
length = float(input('Enter the length of the rectangle: '))
width = float(input('Enter the width of the rectangle: '))
# calculating the area of rectangle
area = length * width
# print result
print('Area of rectangle = ',area)
Output:
Enter the length of the rectangle: 5
Enter the width of the rectangle: 4 Area of rectangle = 20.0
Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.
Similar Code : Python Program to Find Area of a Rectangle