resubmitting square.py

I wasn't difficult to implement a for-loop for square.py because I do have some experience with programming
and replacing the same instructions with no conditionals or decision-making required was easy enough. I took the
repetitive pieces, counted them (squares have 4 sides) and used that as the basis for the instructions inside the loop,
then set the for-loop to iterate those four repetitions.
This commit is contained in:
Pat Wick 2023-07-24 08:55:04 -04:00
parent 6f1d2d6c40
commit 2a1f9b15af
1 changed files with 3 additions and 8 deletions

View File

@ -1,14 +1,9 @@
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)
for i in range(4):
forward(side_length)
right(90)
sizes = [20, 40, 60, 80, 100]
for size in sizes: