generated from mwc/lab_names
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.
This commit is contained in:
18
shapes.py
18
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)
|
||||
|
||||
Reference in New Issue
Block a user