i changed the square.py file to use iteration

checkpoint 1: no it wasn't difficult, i know how to use for loops

checkpoint 2: ranges are super helpful in iteration and can be very useful when you want to repeat stuff or go through data

checkpoint 3: yes, i do think i will write docstrings. I've read them in the past and have found them very insightful.
they make it easier to know how programs work, similar to comments in functions.
This commit is contained in:
ilmabura
2025-09-07 22:35:34 -04:00
parent f11330af49
commit 0df5838eb4
2 changed files with 10 additions and 11 deletions

View File

@@ -1,14 +1,10 @@
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 x in range(4):
forward(side_length)
right(90)
sizes = [20, 40, 60, 80, 100]
for size in sizes: