generated from mwc/lab_names
I already submitted the changes I made in checkpoint 1 so please let me know if I need to rewrite the changes I made in checkpoint 1 since I am saving it again. I will only be talking about checkpoint 2 now. I removed the pass in the triangle and rectangle functions and added the necessary code by using right and forward in the turtle library to make triangles and rectangles appear.
Checkpoint 2: -A function is like a variable in that it allows you to save code that will be ran everytime you call it. -Functions can break down big problems by allowing you to run the same thing over and over by just calling it. An example would be coding a house. This chould be accomplished by making a door function, triangle function, and rectangle function which could be used for the walls and smaller rectangles that could be used for the windows.
This commit is contained in:
17
shapes.py
17
shapes.py
@@ -5,7 +5,20 @@
|
||||
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