Rewrote square() using a for-loop that calls the forward() and right() command once, 4 times

This commit is contained in:
kated
2026-02-10 11:13:47 -05:00
parent 79a4f73aad
commit 01589596c6
3 changed files with 22 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: