Rewrote square function using iteration.

- No, the wording of the lab was a little confusing because it says to use
list iteration but you don't actually need a list for it. Also, the function
still "calls" forward and right four times; we only wrote it once.
This commit is contained in:
tgaeta
2025-09-15 13:21:18 -04:00
parent ab8de63b67
commit 19d67c8363

View File

@@ -1,12 +1,7 @@
from turtle import *
def square(side_length):
forward(side_length)
right(90)
forward(side_length)
right(90)
forward(side_length)
right(90)
for _ in range(4):
forward(side_length)
right(90)