Files
lab_names/shapes.py
njmason2 7883637d8b shapes.py
In a computer program a function can be used many times, just like a
variable, with different input values and different output values possible.
In modular programmimg and object-oriented programming, hundreds or even thousands
of functions can be "called" by a main program, such as a large program that
calculates your Federal IRS 1040 Income Tax each year. The program has to be
updated each year for changes in the current year tax laws.
2025-08-31 10:25:09 -04:00

24 lines
385 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(width)
right(90)
forward(height)
right(90)
forward(width)
right(90)
forward(height)
right(90)