From 19d67c83638a1eb65147ae38ad37587a3facefb2 Mon Sep 17 00:00:00 2001 From: tgaeta Date: Mon, 15 Sep 2025 13:21:18 -0400 Subject: [PATCH] Rewrote square function using iteration. - No, the wording of the lab was a little confusing because it says to use list iteration but you don't actually need a list for it. Also, the function still "calls" forward and right four times; we only wrote it once. --- square.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/square.py b/square.py index f1fb2a2..3289198 100644 --- a/square.py +++ b/square.py @@ -1,14 +1,9 @@ from turtle import * def square(side_length): - forward(side_length) - right(90) - forward(side_length) - right(90) - forward(side_length) - right(90) - forward(side_length) - right(90) + for _ in range(4): + forward(side_length) + right(90) sizes = [20, 40, 60, 80, 100] for size in sizes: