simplify squre

1 A little bit difficult to think what should put into [] i initially defined a new variable. but after read the prompt closely, I found it unnecessary
prompt is helpful.
This commit is contained in:
grace-xing6 2024-09-08 21:23:27 -04:00
parent ad345de973
commit 51f631303f
1 changed files with 9 additions and 10 deletions

View File

@ -1,16 +1,15 @@
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)
moves = [1,1,1,1]
for move in moves:
forward(side_length)
right(90)
sizes = [20, 40, 60, 80, 100]
sizes = [20,40,60,80,100]
for size in sizes:
square(size)
square(40)
penup()
forward(40)
pendown()