generated from mwc/lab_iteration
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:
parent
50d5a6d3fa
commit
de55a916bd
30
square.py
30
square.py
|
@ -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()
|
Loading…
Reference in New Issue