From 29b250ff8315dc5d999db282924ef22022e5a17b Mon Sep 17 00:00:00 2001 From: Chris Mekelburg Date: Sat, 7 Sep 2024 20:40:47 -0400 Subject: [PATCH] changed square.py to use list iteration, ck #1 I thought the directions were very clear for the list iteration although I did need to read through them several times, and tried to understand what they were saying before opening the file. I then ran the original code to see what it did, so I could compare my final product. As I worked on the list iteration, I also kept the original code at top commented out so I could refer to it, and did not delete it until I was sure my iteration method worked. I was not totally sure if I could call the list whatever I wanted to, but it seems like I could as long as one of the names is singular and the other is plural. I feel like I have a good grasp of iteration after this part. --- square.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/square.py b/square.py index c5f1cac..ee5f483 100644 --- a/square.py +++ b/square.py @@ -1,14 +1,13 @@ 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) + sides = [1,2,3,4] + + for side in sides: + forward(side_length) + right(90) sizes = [20, 40, 60, 80, 100] for size in sizes: