generated from mwc/lab_iteration
We changed the shapes.py code to make it repeat
with list iteration
This commit is contained in:
13
square.py
13
square.py
@@ -1,15 +1,10 @@
|
|||||||
from turtle import *
|
from turtle import *
|
||||||
|
|
||||||
def square(side_length):
|
def square(side_length):
|
||||||
forward(side_length)
|
for i in range(4):
|
||||||
right(90)
|
forward(side_length)
|
||||||
forward(side_length)
|
right(90)
|
||||||
right(90)
|
|
||||||
forward(side_length)
|
|
||||||
right(90)
|
|
||||||
forward(side_length)
|
|
||||||
right(90)
|
|
||||||
|
|
||||||
sizes = [20, 40, 60, 80, 100]
|
sizes = [20, 40, 60, 80, 100]
|
||||||
for size in sizes:
|
for size in sizes:
|
||||||
square(size)
|
square(size)
|
||||||
|
|||||||
Reference in New Issue
Block a user