Added Homework 04 - Strings
This commit is contained in:
parent
aad4e226c5
commit
be356ccb59
24 changed files with 315 additions and 0 deletions
14
homework/homework04/results/rectangles001.py
Normal file
14
homework/homework04/results/rectangles001.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
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}")
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue