From 6c0b2827e9d237f5eb26d0e9de8afa842c98423e Mon Sep 17 00:00:00 2001 From: cdonahue Date: Fri, 26 Sep 2025 09:31:59 -0400 Subject: [PATCH] I changed the four original lines of making squares into a loop of 4 shortening the code No it was not difficult to figure out how to rewrite square using a for-loop. The strategy i used was reading --- square.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/square.py b/square.py index f1fb2a2..927fafc 100644 --- a/square.py +++ b/square.py @@ -1,17 +1,15 @@ 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: - square(size) + square(20) + penup() + forward(40) + pendown() input()