From 2a1f9b15af27a643c664d213745ad2bb1f253425 Mon Sep 17 00:00:00 2001 From: Pat Wick Date: Mon, 24 Jul 2023 08:55:04 -0400 Subject: [PATCH] resubmitting square.py I wasn't difficult to implement a for-loop for square.py because I do have some experience with programming and replacing the same instructions with no conditionals or decision-making required was easy enough. I took the repetitive pieces, counted them (squares have 4 sides) and used that as the basis for the instructions inside the loop, then set the for-loop to iterate those four repetitions. --- square.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/square.py b/square.py index c5f1cac..4f9937b 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 i in range(4): + forward(side_length) + right(90) sizes = [20, 40, 60, 80, 100] for size in sizes: