generated from mwc/project_drawing
	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
		
			
				
	
	
		
			97 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			97 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
# drawing.py
 | 
						|
# ----------
 | 
						|
# By ____(you)___________
 | 
						|
#
 | 
						|
# (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()
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 |