From ead11bc16c843c0d12261a840abc47e01a9d67d4 Mon Sep 17 00:00:00 2001 From: Cory Dean Chung Date: Wed, 19 Jul 2023 20:50:07 -0400 Subject: [PATCH] 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. --- shapes.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/shapes.py b/shapes.py index 731ec39..64db46e 100644 --- a/shapes.py +++ b/shapes.py @@ -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)