Files
lab_names/shapes.py
ilmabura ee90c789cd I created functions and did math using python
checkpoint 1
-A name is like an identifier that is empty. It only gains importance once it is assigned a value, which is the data
stored under the name. It's like the net worths. people are just people until you find out their networth.
-it's easier to refer back to and connect your code when using variables. It also allows you to change the values
without having to change all your code

checkpoint 2
-a function is similar to a variable because it makes it easier to reference a set of code. With it, you don't need to
repeatedly write out the same few lines of code
-functions are like mini projects in a big scheme. You can solely achieve the big picture by completing functions. The
best part of is that you can check if a function is working wihout having to run all your code. the names lab is a good
example, I tested the shapes as I wrote the functions and once they were done, I could run the drawing.
2025-09-06 22:59:28 -04:00

28 lines
398 B
Python

# shapes.py
# ---------
# By MWC contributors
from turtle import *
def triangle(side_length):
pendown()
right(90)
for x in range(3):
forward(side_length)
right(120)
return
def rectangle(height, width):
pendown()
right(90)
for x in range(2):
forward(height)
right(90)
forward(width)
right(90)
return