From daae31288d4f695c72f697afc620eda0fa553d85 Mon Sep 17 00:00:00 2001 From: Cory Dean Chung Date: Thu, 20 Jul 2023 12:42:11 -0400 Subject: [PATCH] I rewrote the repeated lines using a for loop. Checkpoint 1: It was not difficult. I used the model from the assignment description to create the loop and removed the now redundant lines. I ran it with python square.py to check that it worked, and it seemed to. --- poetry.lock | 6 +++--- square.py | 11 +++-------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/poetry.lock b/poetry.lock index daa6053..62ca3d1 100644 --- a/poetry.lock +++ b/poetry.lock @@ -497,13 +497,13 @@ sphinx = ">=7.0.1,<8.0.0" [[package]] name = "urllib3" -version = "2.0.3" +version = "2.0.4" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false python-versions = ">=3.7" files = [ - {file = "urllib3-2.0.3-py3-none-any.whl", hash = "sha256:48e7fafa40319d358848e1bc6809b208340fafe2096f1725d05d67443d0483d1"}, - {file = "urllib3-2.0.3.tar.gz", hash = "sha256:bee28b5e56addb8226c96f7f13ac28cb4c301dd5ea8a6ca179c0b9835e032825"}, + {file = "urllib3-2.0.4-py3-none-any.whl", hash = "sha256:de7df1803967d2c2a98e4b11bb7d6bd9210474c46e8a0401514e3a42a75ebde4"}, + {file = "urllib3-2.0.4.tar.gz", hash = "sha256:8d22f86aae8ef5e410d4f539fde9ce6b2113a001bb4d189e0aed70642d602b11"}, ] [package.extras] diff --git a/square.py b/square.py index c5f1cac..fe7f115 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 sides in range(4) + forward(side_length) + right(90) sizes = [20, 40, 60, 80, 100] for size in sizes: