generated from mwc/lab_names
refers to something else. For example, your name refers to you, but you are not the same as your name, so you can change your name and still be the same person. Variables can be useful in programming when you are writing lots of code for a specific value. Using variables saves time and reduces the amount of clutter when writing lots of code for the specific value.
23 lines
380 B
Python
23 lines
380 B
Python
# shapes.py
|
|
# ---------
|
|
# By MWC contributors
|
|
|
|
from turtle import *
|
|
|
|
def triangle(side_length):
|
|
forward(side_length)
|
|
right(120)
|
|
forward(side_length)
|
|
right(120)
|
|
forward(side_length)
|
|
right(120)
|
|
|
|
def rectangle(height, width):
|
|
forward(height)
|
|
right(90)
|
|
forward(width)
|
|
right(90)
|
|
forward(height)
|
|
right(90)
|
|
forward(width)
|
|
right(90) |