Files
lab_iteration/square.py
tsmith37 034481f2a5 Made the square repeat using a list iteration
It wasnt difficult, it just took some time to figure out how to write it. I used the previous code for how they repeated the square but changed its size to understand how to write the correct code.
2025-09-13 21:07:58 -04:00

18 lines
267 B
Python

from turtle import *
def square(side_length):
repeat = [1, 2, 3, 4]
for repeat in repeat:
forward(side_length)
right(90)
sizes = [20, 40, 60, 80, 100]
for size in sizes:
square(20)
penup()
forward(40)
pendown()
input()