alter the rectangle program you wrote in the last lesson to print out the names of each number being…

alter the rectangle program you wrote in the last lesson to print out the names of each number being printed. remember, length is set to 10 and width is set to 5. your output should look like this: area: 50 perimeter: 30 note that you should be using concatenation to print a string and a variable on the same line each time!

alter the rectangle program you wrote in the last lesson to print out the names of each number being printed. remember, length is set to 10 and width is set to 5. your output should look like this: area: 50 perimeter: 30 note that you should be using concatenation to print a string and a variable on the same line each time!

Answer

Here is a Python - based solution assuming the previous Rectangle program was in Python.

Explanation:

Step1: Define length and width

length = 10
width = 5

Step2: Calculate area

The formula for the area of a rectangle is $A = length\times width$.

area = length * width

Step3: Calculate perimeter

The formula for the perimeter of a rectangle is $P=2\times(length + width)$.

perimeter = 2 * (length + width)

Step4: Print results using concatenation

print("Area: " + str(area))
print("Perimeter: " + str(perimeter))

Answer:

length = 10
width = 5
area = length * width
perimeter = 2 * (length + width)
print("Area: " + str(area))
print("Perimeter: " + str(perimeter))