Files
lab_iteration/square.py
mollychi 63bb343df9 I removed the extra forwards and rights, created a new temporarily assigned variable called sides and juts put numbers 1 through 4 in it as the numbers dont matter since i have assigned values for my forward and right already.
At first I was a little confused on if i had to edit the existing for loop and if so how, so i took a second to run the existing code to see that i dont need to change the existing for loop as that just makes the square run 4 times, i realized i need to make a new for loop inside of square. That was really my only struggle.
2025-09-14 21:06:45 -04:00

16 lines
212 B
Python

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