14 lines
427 B
Python
14 lines
427 B
Python
length = 4
|
|
width = 3
|
|
|
|
# The next line is for the column headers
|
|
print("length width area")
|
|
|
|
# The next two lines generate multiple lengths and widths.
|
|
for length in range(1, 3):
|
|
for width in range(2, 6):
|
|
# The next two lines calculate the area then print the values.
|
|
# Modify the print statement to line up the columns aligned right.
|
|
area = length * width
|
|
print(f"{length} {width} {area}")
|
|
|