From 01589596c63c9a0b54e59bac616295a6a607b875 Mon Sep 17 00:00:00 2001 From: kated Date: Tue, 10 Feb 2026 11:13:47 -0500 Subject: [PATCH] Rewrote square() using a for-loop that calls the forward() and right() command once, 4 times --- .envrc | 1 + poetry.lock | 18 ++++++++++++++++++ square.py | 11 +++-------- 3 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 .envrc create mode 100644 poetry.lock diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..4a96c22 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +source .venv/bin/activate \ No newline at end of file diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..6e37ab5 --- /dev/null +++ b/poetry.lock @@ -0,0 +1,18 @@ +# This file is automatically @generated by Poetry 2.3.1 and should not be changed by hand. + +[[package]] +name = "superturtle" +version = "0.2.0" +description = "Extensions to Python's turtle" +optional = false +python-versions = "<4.0,>=3.9" +groups = ["main"] +files = [ + {file = "superturtle-0.2.0-py3-none-any.whl", hash = "sha256:ca3a31be3259387b4490846adbf64502acc9d23472912cc43497ab170e89f506"}, + {file = "superturtle-0.2.0.tar.gz", hash = "sha256:807fb419c1dba9cb809a22a68e72c0193bdeed4a9326eb36ad940b2a7ff6ac04"}, +] + +[metadata] +lock-version = "2.1" +python-versions = ">=3.10,<4.0" +content-hash = "6aad436bbbf760fa856344262eab22d62a167cac4e5dfefbf4be77d5a37428c9" diff --git a/square.py b/square.py index f1fb2a2..ba447e2 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: