All Code HS codes unit 2 Latest 2023
Graded A+
2.1.4 stretched slinky ✔✔circle(35)
forward(40)
circle(35)
forward(40)
circle(35)
forward(40)
circle(35)
forward(40)
circle(35)
forward(40)
2.2.4 shorter dashed
...
All Code HS codes unit 2 Latest 2023
Graded A+
2.1.4 stretched slinky ✔✔circle(35)
forward(40)
circle(35)
forward(40)
circle(35)
forward(40)
circle(35)
forward(40)
circle(35)
forward(40)
2.2.4 shorter dashed line ✔✔penup()
backward(200)
pendown()
forward(50)
penup()
forward(50)
pendown()
forward(50)
penup()
forward(50)
pendown()
forward(50)
penup()
forward(50)
pendown()
forward(50)
penup()
forward(50)
2.2.5 caterpillar ✔✔circle(20)
penup()
forward(40)
pendown()
circle(20)
penup()
forward(40)
pendown()
circle(20)
penup()
forward(40)
pendown()
circle(20)
penup()
forward(40)
pendown()
circle(20)
2.3.5 rectangle ✔✔forward(50)
left(90)
forward(100)
left(90)
forward(50)
left(90)
forward(100)
left(90)
2.3.6 4 columns ✔✔penup()
left(90)
forward(200)
right(90)
right(90)
pendown()
forward(400)
penup()
right(90)
forward(100)
pendown()
right(90)
forward(400)
right(90)
penup()
forward(200)
pendown()
right(90)
forward(400)
2.4.5 row of circles ✔✔speed(0)
penup()
backward(200)
pendown()
forward(10)
for i in range(20):
circle(10)
penup()
forward(20)
pendown()
2.4.6 4 columns 2.0 ✔✔speed(0)
for i in range(1):
penup()
backward(200)
right(90)
forward(100)
left(90)
forward(100)
left(90)
pendown()
forward(400)
right(90)
penup()
forward(400)
left(90)
penup()
forward(100)
left(90)
pendown()
forward(400)
2.5.5 hexagon ✔✔speed(0)
for i in range(6):
forward(50)
left(60)
2.5.6 x marks the spot ✔✔speed(0)
left(45)
for i in range(4):
forward(100)
backward(100)
left(90)
2.5.7 circle pyramid ✔✔speed(0)
penup()
setposition(-100,-200)
for i in range (3):
pendown()
circle(50)
penup()
forward(100)
setposition(-50,-100)
for i in range (2):
pendown()
circle(50)
penup()
forward(100)
pendown()
penup()
setposition(0,0)
pendown()
circle(50)
penup()
forward(100)
pendown()
2.6.4 circle pyramid with comments ✔✔speed(0)
"""
this program will make a pyramid of circles
"""
penup()
setposition(-100,-200)
# bottom circle line
for i in range (3):
pendown()
circle(50)
penup()
forward(100)
setposition(-50,-100)
#middle circle line
for i in range(2):
pendown()
circle(50)
penup()
forward(100)
#top circle
setposition(0,0)
pendown()
circle(50)
penup()
forward(100)
2.8.4 beaded bracelet ✔✔speed(0)
"""
there must be 36 beads, a radius of 10 pixles, and the braclet must have
a diameter of 200. use a function and turn tracy 10 degrees after drawing
and return to the middle of each bead.
"""
speed(0)
def draw_beaded_braclet():
for i in range(36):
penup()
forward(100)
pendown()
circle(10)
penup()
backward(100)
left(10)
draw_beaded_braclet()
2.8.5 shape stack ✔✔"""
this code will draw a stack of four squars and four cirlces alternating
from top to bottom
"""
speed(0)
#this function will draw a squrae and then and then movs to the position to draw the circle
def draw_square():
pendown()
for i in range(4):
forward(50)
penup()
left(90)
forward(50)
right(90)
forward(25)
#this function draws a circle and then moves to position to draw a square
def draw_circle():
pendown()
circle(25)
penup()
backward(25)
left(90)
forward(50)
right(90)
#tracy is to start position and then starts drawing circles and squares alternating
penup()
setposition(-25,-200)
for i in range(4):
draw_circle()
draw_square()
2.9.5 four colored triangles ✔✔speed(0)
pensize(5)
color("red")
backward(100)
forward(200)
backward(200)
left(45)
for i in range(4):
color("green")
forward(50)
right(90)
color("blue")
forward(50)
2.9.6 colorful bracelet ✔✔speed(0)
def draw_colored_braclet():
for i in range(12):
penup()
color("purple")
forward(100)
pendown()
begin_fill()
circle(10)
end_fill()
penup()
backward(100)
left(10)
penup()
color("blue")
forward(100)
pendown()
begin_fill()
circle(10)
end_fill()
penup()
backward(100)
left(10)
penup()
color("red")
forward(100)
pendown()
begin_fill()
circle(10)
end_fill()
penup()
backward(100)
left(10)
draw_colored_braclet()
2.10.4 bubble wrap 2.0 ✔✔"""
This code will fill the canvas with light blue circles.
Now add a function that will draw a white highlight on each bubble.
"""
speed(0)
# This function will draw one row of 10 circles
def draw_circle_row():
for i in range(10):
pendown()
begin_fill()
color("light blue")
circle(20)
end_fill()
penup()
forward(40)
# This function will move Tracy from end of row up to beginning of the row on top
def move_up_a_row():
left(90)
forward(40)
right(90)
backward(400)
# Send Tracy to starting position in bottom left corner
penup()
setposition(-180,-200)
# Call circle drawing function 10 times to fill ten rows
for i in range(10):
draw_circle_row()
move_up_a_row()
2.10.5 sidewalk ✔✔speed(0)
def line_of_squares():
for i in range(8):
pendown()
right(45)
circle(35,360,4)
left(45)
forward(50)
penup()
setposition(-200,150)
line_of_squares()
penup()
setposition(-200,-200)
line_of_squares()
penup()
setposition(200,-200)
left(90)
line_of_squares()
penup()
setposition(-150,-200)
line_of_squares()
2.11.4 dartboard ✔✔speed(0)
radius=25
penup()
setposition(0,-25)
def move_down():
penup()
right(90)
forward(25)
left(90)
pendown()
for i in range(4):
move_down()
circle(radius)
radius=radius+25
2.11.5 line of increasing blocks ✔✔speed(3)
size=10
def make_square():
for i in range(4):
pendown()
forward(size)
left(90)
setposition(-150,0)
for i in range(5):
make_square()
penup()
forward(2*size)
size=size+10
2.12.4 colorful dartboard ✔✔radius=100
for i in range(4):
penup()
setposition(0,0)
right(90)
forward(radius)
left(90)
color_choice= input("what color should the circle be?")
color(color_choice)
begin_fill()
circle(radius)
end_fill()
radius=radius-25
radius=75
for i in range(4):
penup()
setposition(0,0)
right(90)
forward(radius)
left(90)
color_choice= input("what color should the circle be?")
color(color_choice)
begin_fill()
circle(radius)
end_fill()
radius=radius-25
radius=50
for i in range(4):
penup()
setposition(0,0)
right(90)
forward(radius)
left(90)
color_choice= input("what color should the circle be?")
color(color_choice)
begin_fill()
circle(radius)
end_fill()
radius=radius-25
radius=25
for i in range(4):
penup()
setposition(0,0)
right(90)
forward(radius)
left(90)
color_choice= input("what color should the circle be?")
color(color_choice)
begin_fill()
circle(radius)
end_fill()
radius=radius-25
2.12.5 four corners ✔✔speed(0)
int(input("square_length"))
penup()
setposition(-200,-200)
pendown()
left(90)
for i in range(4):
forward(50)
right(90)
penup()
forward(400)
pendown()
right(90)
for i in range(4):
forward(50)
right(90)
forward(400)
pendown()
right(90)
for i in range(4):
forward(50)
right(90)
forward(400)
pendown()
right(90)
for i in range(4):
forward(50)
right(90)
2.13.4 colorful caterpillar ✔✔penup()
setposition(-100,0)
pendown()
def draw_circle(color_choice):
for i in range(1):
circle(15)
color(color_choice)
begin_fill()
circle(15)
end_fill()
color_one=input("what color should circle one be?")
color_two=input("what color should cirlce two be?")
color_three=input("what color should circle three be?")
color_four=input("what color should circle four be?")
for i in range (2):
draw_circle(color_one)
penup()
forward(30)
pendown()
draw_circle(color_two)
penup()
forward(30)
pendown()
draw_circle(color_three)
penup()
forward(30)
pendown()
draw_circle(color_four)
penup()
forward(30)
2.13.5 circle in square ✔✔speed(0)
first_radius=int(input("what is the first circle's radius?:"))
def draw_square_big(color_choice, radius_choice):
penup()
backward(first_radius)
pendown()
color(color_choice)
begin_fill()
for i in range(4):
forward(first_radius*2)
left(90)
end_fill()
def draw_circle_wide(color_choice, radius_choice):
pendown()
color(color_choice)
begin_fill()
circle(radius_choice)
end_fill()
penup()
setposition(0,-first_radius)
draw_square_big("red", first_radius)
penup()
setposition(0,-first_radius)
draw_circle_wide("blue", first_radius)
2.13.6 snowman ✔✔# put imput
inputs = [100]
#functions
def draw_circle(radius):
pendown()
begin_fill()
circle(radius)
end_fill()
penup()
left(90)
forward(radius*2)
right(90)
penup()
setposition(0,-200)
color("gray")
bottom_radius = int(input("What should the radius of the bottom circle be?: "))
#parameters
draw_circle(bottom_radius)
draw_circle(bottom_radius/2)
draw_circle(bottom_radius/4)
2.14.4 geometry 2.0 ✔✔penup()
setposition(0,-100)
pendown()
radius = 20
for i in range(7):
circle(radius,360,i)
radius=(radius + 20)
2.15.4 dartboard unsing i ✔✔speed(0)
penup()
radius=2
for i in range(25,101,25):
setposition(0,0)
right(90)
forward(i)
left(90)
pendown()
circle(i)
penup()
def draw_something():
forward(20)
2.15.5 phone signal ✔✔speed(0)
for i in range(10, 51, 10):
forward(10)
left(90)
forward(i)
left(90)
forward(10)
left(90)
forward(i)
left(90)
penup()
forward(25)
pendown()
2.16.4 happy face ✔✔inputs = ["Yes"]
def draw_eye():
color("black")
begin_fill()
pendown()
circle(10)
end_fill()
penup()
happy = input("Are you happy? (Yes/No): ")
if happy == "Yes":
penup()
right(90)
2.16.5 black and white squares ✔✔inputs = ["Yes"]
def draw_black_square():
color("black")
begin_fill()
pendown()
circle(10)
end_fill()
penup()
black = input("Is square black? (Yes/No): ")
if black %"Yes":
penup()
right(90)
for i in range(1):
pendown()
2.17.4 rating ✔✔def draw_x():
color("red")
right(45)
forward(50)
right(90)
forward(50)
backward(100)
def draw_line():
color("yellow")
forward(50)
backward(100)
def draw_checkmark():
color("green")
left(45)
forward(100)
backward(100)
left(90)
forward(50)
rating=int(input("on a scale of one-ten rate tracy"))
if rating<5:
draw_x()
elif rating==7:
draw_line()
else:
draw_checkmark()
2.17.5 happy/sad face ✔✔inputs = ["Yes"]
def draw_eye():
color("black")
begin_fill()
pendown()
circle(10)
end_fill()
penup()
happy = input("Are you happy? (Yes/No): ")
if happy == "Yes":
penup()
right(90)
2.18.4 increasing squares ✔✔length = 50
speed(0)
#while loop for drawing the squares
def drawSquare(l):
for i in range(4):
forward(l)
left(90)
while length < 400:
penup()
backward(length/2)
right(90)
forward(length/2)
left(90)
pendown()
drawSquare(length)
penup()
forward(length/2)
left(90)
forward(length/2)
right(90)
length = length + 50
2.18.5 guess a number ✔✔"tracy is ask user to guess number from 1-10"
#user number
user_number= int(input("Pick a number from 1-10?:"))
#variable for secret number
secret_number=7
def draw_checkmark():
penup()
backward(50)
right(90)
pendown()
pensize(15)
color("green")
left(45)
forward(50)
left(90)
forward(100)
penup()
draw_checkmark()
2.19.4 guess a number 2.0 ✔✔"tracy is ask user to guess number from 1-10"
#user number
user_number= int(input("Pick a number from 1-10?:"))
#variable for secret number
secret_number=7
def draw_checkmark():
penup()
backward(50)
right(90)
pendown()
pensize(15)
color("green")
left(45)
forward(50)
left(90)
forward(100)
penup()
draw_checkmark()
if user_number < 5:
circle(50)
elif count > 5:
circle(50,360,4)
else:
forward(50)
2.19.5 circle pyramid 2.0 ✔✔radius = int(input("What is the radius of the circle? "))
row_value= int(input("What is the row value of the circle? "))
def row_value():
setposition(0, radius)
for i in range(15):
circle(25)
row_value()
[Show More]