Skip to content

Commit 22a1fa9

Browse files
committed
Add in a lot of code from 2.9 and onward
1 parent 9e6b478 commit 22a1fa9

8 files changed

+205
-0
lines changed
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
startingRadius = (25 * 4)
2+
radiusGrowth = 25
3+
4+
def draw_concentric_circles(m_radius, m_growth):
5+
penup()
6+
right(90)
7+
forward(startingRadius)
8+
left(90)
9+
for i in range(4):
10+
pendown()
11+
begin_fill()
12+
color_choice = input("Choose a color for circle " + str(i) + ": ")
13+
color(color_choice)
14+
circle(startingRadius - (radiusGrowth * i))
15+
end_fill()
16+
penup()
17+
left(90)
18+
forward(radiusGrowth)
19+
right(90)
20+
21+
draw_concentric_circles(startingRadius, radiusGrowth)

CodeHS/2/12/5/Four Corners-Joe.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
def drawCube(side_len):
2+
pendown()
3+
for i in range(16): # 16 beacuse codehs is dumb
4+
forward(side_len)
5+
left(90)
6+
penup()
7+
8+
penup()
9+
setposition(-200, -200)
10+
for i in range(4):
11+
square_length = input("Enter square size: ")
12+
drawCube(square_length)
13+
forward(400)
14+
left(90)
15+
print("Done!")
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
def drawCube(side_len):
2+
pendown()
3+
for i in range(16): # 16 beacuse codehs is dumb
4+
forward(side_len)
5+
left(90)
6+
penup()
7+
8+
penup()
9+
setposition(-200, -200)
10+
for i in range(4):
11+
square_length = input("Enter square size: ")
12+
drawCube(square_length)
13+
forward(400)
14+
left(90)
15+
print("Done!")
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
circleColor = "Blue"
2+
squareColor = "Red"
3+
4+
def circle_in_square(radius):
5+
pendown()
6+
begin_fill()
7+
color(squareColor)
8+
forward(radius)
9+
for i in range(3):
10+
left(90)
11+
forward(int(radius) * 2)
12+
print("Drawing square with radius " + str(int(radius * 2)))
13+
left(90)
14+
forward(radius)
15+
end_fill()
16+
begin_fill()
17+
print("Drawing Circle with radius " + str(radius))
18+
color(circleColor)
19+
circle(radius)
20+
end_fill()
21+
22+
circle_in_square(input("Shape Size: "))

CodeHS/2/13/6/Snowman-Joe.py

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"""
2+
This program made by Joe
3+
"""
4+
snowman_list = []
5+
6+
def draw_snowman(m_inputs):
7+
for current_ball in m_inputs:
8+
pendown()
9+
color("grey")
10+
begin_fill()
11+
circle(int(current_ball))
12+
end_fill()
13+
penup()
14+
left(90)
15+
forward(2 * int(current_ball))
16+
right(90)
17+
18+
def draw_sequential_snowman(m_input):
19+
for i in range(3):
20+
pendown()
21+
color("grey")
22+
begin_fill()
23+
circle(m_input)
24+
m_input = m_input / 2
25+
end_fill()
26+
penup()
27+
left(90)
28+
forward(4 * int(m_input))
29+
right(90)
30+
31+
penup()
32+
setposition(0,-200)
33+
for i in range(3):
34+
user_input = input("Size for ball " + str(i + 1) + ": ")
35+
snowman_list.append(user_input)
36+
#draw_snowman(snowman_list)
37+
draw_sequential_snowman(100)
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
This program made by Joe
3+
"""
4+
startingRadius = 25
5+
radiusGrowth = 25
6+
7+
def draw_concentric_circles(m_radius, m_growth):
8+
for i in range(4):
9+
circle(m_radius + (m_growth * i))
10+
right(90)
11+
penup()
12+
forward(m_growth)
13+
pendown()
14+
left(90)
15+
16+
draw_concentric_circles(startingRadius, radiusGrowth)

CodeHS/2/16/4/Happy Face-Joe.py

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
"""
2+
This program made by Joe
3+
"""
4+
def startDraw(requestedColor):
5+
pendown()
6+
color(requestedColor)
7+
begin_fill()
8+
9+
def stopDraw():
10+
end_fill()
11+
penup()
12+
13+
def drawSmile(happy, headcolor, headsize):
14+
eyeHeight = headsize * 1.5
15+
16+
startDraw(headcolor)
17+
circle(headsize)
18+
stopDraw()
19+
forward(headsize * 0.6)
20+
left(90)
21+
forward(eyeHeight)
22+
left(90)
23+
for i in range(2):
24+
forward(headsize * 0.3)
25+
startDraw("Black")
26+
circle(headsize * 0.1)
27+
stopDraw()
28+
forward(headsize * 0.3)
29+
left(90)
30+
forward(eyeHeight)
31+
left(90)
32+
forward(headsize * 0.6)
33+
34+
if (happy == "happy"):
35+
left(90)
36+
forward(headsize * 0.8)
37+
left(90)
38+
forward(headsize * 0.5)
39+
left(90)
40+
startDraw("Black")
41+
circle(headsize * 0.5, 180)
42+
left(90)
43+
forward((headsize * 0.5) * 2)
44+
stopDraw()
45+
elif (happy == "sad"):
46+
left(90)
47+
forward(headsize * 0.4)
48+
right(90)
49+
forward(headsize * 0.5)
50+
left(90)
51+
startDraw("Black")
52+
circle(headsize * 0.5, 180)
53+
left(90)
54+
forward((headsize * 0.5) * 2)
55+
stopDraw()
56+
else:
57+
print("Error in input, expected 'happy' or 'sad'")
58+
print(happy)
59+
60+
drawSmile(input("Input your mood, supported inputs are: happy and sad:"), "Yellow", 80)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""
2+
This program made by Joe
3+
"""
4+
numSquares = 6
5+
squareSize = 20
6+
7+
def doSquares():
8+
for square in range(numSquares):
9+
if (square % 2 == 0):
10+
begin_fill()
11+
for i in range(4):
12+
forward(squareSize)
13+
left(90)
14+
end_fill()
15+
penup()
16+
forward(20 + squareSize)
17+
pendown()
18+
19+
doSquares()

0 commit comments

Comments
 (0)