From 51f631303f5d4e85c6b8476517b6650f9ca321f1 Mon Sep 17 00:00:00 2001 From: grace-xing6 Date: Sun, 8 Sep 2024 21:23:27 -0400 Subject: [PATCH] simplify squre 1 A little bit difficult to think what should put into [] i initially defined a new variable. but after read the prompt closely, I found it unnecessary prompt is helpful. --- square.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/square.py b/square.py index c5f1cac..aeb5872 100644 --- a/square.py +++ b/square.py @@ -1,16 +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) + moves = [1,1,1,1] + for move in moves: + forward(side_length) + right(90) -sizes = [20, 40, 60, 80, 100] +sizes = [20,40,60,80,100] for size in sizes: - square(size) + square(40) + penup() + forward(40) + pendown()