Learn about Python Program to Find Area of a Rectangle using Function in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.
Python Program to Find Area of a Rectangle using Function
# program to find area of rectangle using functions #function def area_of_rectangle(length, width): area = length * width return area # inputs length = float(input('length of the rectangle: ')) width = float(input('width of the rectangle: ')) # print result print('Area of rectangle = %.2f ' %area_of_rectangle(length, width))
length of the rectangle: 5 width of the rectangle: 10 Area of rectangle = 50.00
Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.
Similar Code : Find the Area of a Rectangle in Python