generated from mwc/lab_iteration
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.
16 lines
212 B
Python
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()
|
|
|