generated from mwc/project_drawing
Description
I will create a christmas tree with three triangles on the top, and then a brown tree stump at the bottom. Also I will create 2 presents for underneath different colors coreection: As I thought about it, I am changing this to a 3 tiered cake with sprinkles. each layer has a different color. I feel more comforatble w this write rectangle (width, height, color) and square() functions make the cake tiered, 3 levels i struggled with iteration for sizes, and positioning of the three levels, but i prevailed coding the functions for the square and triangle seemed easy enough it is easier than writing a different size code for each tiered square completed*** write code for rectangle and square create a function for each of these ***It took a long time, but I have the codes for rectangle and square use iteration to make the sprinkles color the cake's tiers red, gree, blue also create a list of sizes for the squares using iteration, as well for the sprinkles combine all functions and iterations and colors to make the final cake
This commit is contained in:
38
README.md
38
README.md
@@ -1,21 +1,33 @@
|
||||
# (Drawing project)
|
||||
|
||||
(
|
||||
This is the README file for your drawing project.
|
||||
Replace all the text in parentheses with your own text.
|
||||
It's written in a simple language called Markdown,
|
||||
which allows basic formatting.
|
||||
)
|
||||
|
||||
## Description
|
||||
|
||||
(Describe your goal for this project. If you want to link to an
|
||||
image, move the image to this directory, and then use the following syntax:
|
||||
I will create a christmas tree with three triangles on the top, and then a brown tree stump at the bottom. Also I will create 2 presents for underneath different colors
|
||||
|
||||

|
||||
|
||||
)
|
||||
coreection: As I thought about it, I am changing this to a 3 tiered cake with sprinkles.
|
||||
each layer has a different color. I feel more comforatble w this
|
||||
|
||||
## Planning
|
||||
|
||||
(Include your planning here, including your project milestone.)
|
||||
### milestone 1
|
||||
write rectangle (width, height, color) and square() functions
|
||||
make the cake tiered, 3 levels
|
||||
|
||||
i struggled with iteration for sizes, and positioning of the three levels, but i prevailed
|
||||
coding the functions for the square and triangle seemed easy enough
|
||||
it is easier than writing a different size code for each tiered square
|
||||
|
||||
completed***
|
||||
write code for rectangle and square
|
||||
create a function for each of these
|
||||
***It took a long time, but I have the codes for rectangle and square
|
||||
|
||||
|
||||
### milestone 2
|
||||
use iteration to make the sprinkles
|
||||
color the cake's tiers red, gree, blue
|
||||
also create a list of sizes for the squares using iteration, as well for the sprinkles
|
||||
|
||||
|
||||
### milestone 3
|
||||
combine all functions and iterations and colors to make the final cake
|
||||
|
||||
89
drawing.py
89
drawing.py
@@ -5,3 +5,92 @@
|
||||
# (Briefly describe what this program does.)
|
||||
|
||||
from turtle import *
|
||||
|
||||
def square(side_length):
|
||||
forward (side_length)
|
||||
right(90)
|
||||
forward(side_length)
|
||||
right(90)
|
||||
forward(side_length)
|
||||
right(90)
|
||||
forward(side_length)
|
||||
right(90)
|
||||
|
||||
def sprinkles():
|
||||
def square(side_length):
|
||||
side_lengths = (side_length, side_length, side_length, side_length)
|
||||
for side_lengths in side_lengths:
|
||||
forward(side_length)
|
||||
right(90)
|
||||
|
||||
sizes = [20, 40, 60, 80]
|
||||
for size in sizes:
|
||||
color("blue")
|
||||
begin_fill()
|
||||
square(10)
|
||||
end_fill()
|
||||
penup()
|
||||
forward(40)
|
||||
pendown()
|
||||
|
||||
|
||||
def rectangle():
|
||||
forward(150)
|
||||
right(90)
|
||||
forward(100)
|
||||
right(90)
|
||||
forward(150)
|
||||
right(90)
|
||||
forward(100)
|
||||
right(90)
|
||||
|
||||
def split():
|
||||
rectangle()
|
||||
square()
|
||||
|
||||
def cake():
|
||||
color("red")
|
||||
begin_fill()
|
||||
rectangle()
|
||||
end_fill()
|
||||
penup()
|
||||
forward(30)
|
||||
left(90)
|
||||
pendown()
|
||||
color("green")
|
||||
begin_fill()
|
||||
square(100)
|
||||
end_fill()
|
||||
penup()
|
||||
forward(100)
|
||||
right(90)
|
||||
forward(15)
|
||||
left(90)
|
||||
color("orange")
|
||||
begin_fill()
|
||||
square(75)
|
||||
end_fill()
|
||||
left(90)
|
||||
forward(35)
|
||||
left(90)
|
||||
forward(110)
|
||||
left(90)
|
||||
|
||||
|
||||
cake()
|
||||
sprinkles()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
input()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user