I had to think about the function of brackets, and I learned that the items inside of the brackets makes a list. Listing multiple items with commas does not create what we are trying to draw, we need to add 'for-loop' and the language 'for size in sizes' was not understood intuitively. I am unsure if I fully understand all of this yet, but manage to mimick the process.

This commit is contained in:
Seoyeon Lee 2024-09-20 18:51:55 -04:00
parent 50d5a6d3fa
commit de55a916bd
1 changed files with 19 additions and 11 deletions

View File

@ -1,16 +1,24 @@
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)
#def square(side_length):
# forward(side_length)
# right(90)
# forward(side_length)
# right(90)
# forward(side_length)
# right(90)
# forward(side_length)
# right(90)
def square(side_length):
scones = [ 20, 50, 27,8 ]
for score in scones:
forward(side_length)
right(90)
sizes = [20, 40, 60, 80, 100]
for size in sizes:
square(size)
square(size)
input()