From 77075236c716dce77895c8e85180af4a5834d8d2 Mon Sep 17 00:00:00 2001 From: Lauren Dawnkaski Date: Fri, 6 Sep 2024 07:57:04 -0400 Subject: [PATCH] I have reached checkpoint 2. A function and variable are alike since a variable gives a name to a certain value while a function gives a name to a larger amount of values. They both shorten and simplify what needs to be typed in the program as well. Functions might be useful in breaking down big, hard problems because you can work on a certain aspect of the problem and then create a function so you don't have to worry about that small piece of the problem again. For example when working on the turtle lab, since I used a lot of repeated symmetry, this would have been simpler if I could define some functions. --- shapes.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/shapes.py b/shapes.py index 731ec39..d6eadaf 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(width) + right(90) + forward(height) + right(90) + forward(width) + right(90) + forward(height) + right(90)