For triangle, I made it create an equilateral

triangle with side length side_length. For
rectangle, I made it alternate going forward
height and width, turning right 90 degrees each
time.

Checkpoint 1: Already submitted

Checkpoint 2:
A function is like a variable in that it is a
name for something else. Functions could be
helpful in breaking down a big, hard problem
into smaller, easier problems, which can each
be represented by a function, as a big problem
could be rewritten as a series of function
calls. Adding fractions might be an example.
To add the fractions, a common denominator
needs to be found, the fractions have to be
changed into equivalent fractions with the
common denominator, the numerators are added,
and then the fractions are simplified. each
of these four steps might itself be a function
and the adding of fractions could be written
as calling those four functions.
This commit is contained in:
Cory Dean Chung 2023-07-19 20:50:07 -04:00
parent ab6c453892
commit ead11bc16c
1 changed files with 14 additions and 2 deletions

View File

@ -5,7 +5,19 @@
from turtle import *
def triangle(side_length):
pass
forward(side_length)
right(120)
forward(side_length)
right(120)
forward(side_length)
right(120)
def rectangle(height, width):
pass
forward(height)
right(90)
forward(width)
right(90)
forward(height)
right(90)
forward(width)
right(90)