generated from mwc/lab_iteration
Checkpoint 1: I found it difficult to rewrite square() using a for-loop. It has been a long time since I took a coding course so I did not remember much from what I did in previous coding courses to apply here. I did a lot of trial and error to see what I remembered about for-loops and if all went wrong I looked online for examples of how a for-loop properly looks.
15 lines
259 B
Python
15 lines
259 B
Python
from turtle import *
|
|
|
|
def square(side_length):
|
|
|
|
sides = [side_length] * 4
|
|
for side in sides:
|
|
forward(side)
|
|
right(90)
|
|
|
|
sizes = [20, 40, 60, 80, 100]
|
|
for size in sizes:
|
|
square(size)
|
|
|
|
input()
|