Here is the code to compute the area and perimeter of a rectangle with the specified length and width. It also includes print statements to display these values, along with the formulas used.
# Variables for length and width
length = 10
width = 5
# Calculating area and perimeter
area = length * width
perimeter = 2 * (length + width)
# Displaying the results
print(area) # Output the area
print(perimeter) # Output the perimeter
# Displaying the formulas
print("Rectangle Area Formula:")
print("Area = L * W")
print("\nRectangle Perimeter Formula:")
print("Perimeter = 2 * (L + W)")
# Additional explanation of the variables
print("\nL is the length of the rectangle and W is the width of the rectangle.")
When you run this code, it will produce the following output:
50
30
Rectangle Area Formula:
Area = L * W
Rectangle Perimeter Formula:
Perimeter = 2 * (L + W)
L is the length of the rectangle and W is the width of the rectangle.
This gives you the area and perimeter along with the relevant formulas.