#------------------------------------------------------------------------------ # Rectangle2.py # Uses functions #------------------------------------------------------------------------------ # rectangle_area() # computes the area of a rectangle def rectangle_area(x, y): a = x*y return a # end rectangle_area() # rectangle_perimeter() # computes the perimeter of a rectangle def rectangle_perimeter(x, y): p = 2*x + 2*y return p # end rectangle_perimeter() # main program ---------------------------------------------------------------- print("Enter the length and width of a rectangle: ") length = float(input("length: ")) width = float(input("width: ")) print() print("The area is", rectangle_area(length, width)) print("The perimeter is", rectangle_perimeter(length, width)) print() print("Enter the length and width of another rectangle: ") length = float(input("length: ")) width = float(input("width: ")) print() print("The area is", rectangle_area(length, width)) print("The perimeter is", rectangle_perimeter(length, width)) print()