Skip to content

Commit a05d74b

Browse files
KenwoodFoxDirDraggo
and
DirDraggo
authored
added more code (#4)
added more code Co-authored-by: DirDraggo <travbuttons34@gmail.com>
2 parents e9117de + 6f77424 commit a05d74b

21 files changed

+450
-0
lines changed
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
"""
2+
This code will fill the canvas with light blue circles with a white highlight
3+
"""
4+
speed(0)
5+
## This function will draw one row of 10 circles
6+
def draw_circle_row():
7+
for i in range(10):
8+
pendown()
9+
begin_fill()
10+
color("light blue")
11+
circle(20)
12+
end_fill()
13+
penup()
14+
forward(40)
15+
## This function will move Tracy from end of row up to beginning of the row on top
16+
def move_up_a_row():
17+
left(90)
18+
forward(40)
19+
right(90)
20+
backward(400)
21+
## This creates a white highlight in the top right blue circle
22+
def make_highlight():
23+
for i in range(10):
24+
pendown()
25+
color("light blue")
26+
circle(10,90)
27+
color("white")
28+
circle(10,90)
29+
color("light blue")
30+
circle(10,180)
31+
penup()
32+
forward(40)
33+
## Send Tracy to starting position in bottom left corner
34+
penup()
35+
setposition(-180,-200)
36+
# Call circle drawing function 10 times to fill ten rows
37+
for i in range(10):
38+
draw_circle_row()
39+
move_up_a_row()
40+
## Create the highlights
41+
penup()
42+
setposition(-180, -190)
43+
for i in range(10):
44+
make_highlight()
45+
move_up_a_row()

CodeHS/2/10/5/Sidewalk-Travis.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
penup()
2+
setposition(-200,-200)
3+
speed(0)
4+
def draw_square():
5+
for i in range(4):
6+
pendown()
7+
forward(50)
8+
left(90)
9+
def draw_row():
10+
for i in range(8):
11+
draw_square()
12+
penup()
13+
forward(50)
14+
def draw_sidewalk():
15+
for i in range(4):
16+
draw_row()
17+
left(90)
18+
draw_sidewalk()

CodeHS/2/11/4/Dartboard-Travis.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
speed(0)
2+
radius = 25
3+
circle(radius)
4+
def init():
5+
penup()
6+
right(90)
7+
forward(25)
8+
left(90)
9+
for i in range(3):
10+
init()
11+
pendown()
12+
radius = radius + 25
13+
circle(radius)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
speed(0)
2+
penup()
3+
setposition(-150,0)
4+
pendown()
5+
6+
def make_square():
7+
length = 10
8+
for i in range(5):
9+
for i in range(4):
10+
pendown()
11+
forward(length)
12+
left(90)
13+
penup()
14+
forward(length * 2)
15+
length = length + 10
16+
make_square()
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""
2+
Draws 4 circles
3+
"""
4+
speed(0)
5+
radius = 125
6+
penup()
7+
right(90)
8+
forward(100)
9+
left(90)
10+
for i in range(4): ## Draws a circle with radius and color_choice color. repeats 4 times
11+
pendown()
12+
radius = radius - 25
13+
color_choice = input("Color of the circle?: ")
14+
color(color_choice)
15+
begin_fill()
16+
circle(radius)
17+
end_fill()
18+
penup()
19+
left(90)
20+
forward(25)
21+
right(90)

CodeHS/2/17/4/Rating-Travis.py

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
"""
2+
This code will draw a symbol depending on the rating given. A red x mark will
3+
be drawn if the rating is less than or equal to 4, a yellow line will be drawn
4+
if the rating is in between 5 including 5 and 7 including 7. Else, a check will be
5+
drawn
6+
"""
7+
speed(0)
8+
penup()
9+
pensize(10)
10+
rating=int(input("Rating? (1-10): "))
11+
def draw_x(): ## draws a red "x"
12+
left(45)
13+
color("red")
14+
pendown()
15+
for i in range(4):
16+
forward(40)
17+
backward(40)
18+
left(90)
19+
def draw_line(): ## draws a yellow line
20+
pendown()
21+
color("yellow")
22+
backward(30)
23+
forward(60)
24+
def draw_check(): ## draws a green check
25+
right(45)
26+
backward(30)
27+
pendown()
28+
color("green")
29+
forward(30)
30+
left(90)
31+
forward(60)
32+
## check the rating to determine what symbol to draw
33+
if rating <= 4:
34+
draw_x()
35+
elif rating >=5 and rating <=7:
36+
draw_line()
37+
else:
38+
draw_check()
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
speed(0)
2+
penup()
3+
length=0
4+
def move_to_position():
5+
penup()
6+
backward(25)
7+
right(90)
8+
forward(25)
9+
left(90)
10+
def make_square():
11+
pendown()
12+
for i in range(4):
13+
forward(length)
14+
left(90)
15+
penup()
16+
while length < 400:
17+
penup()
18+
make_square()
19+
move_to_position()
20+
length = length + 50
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
speed(0)
2+
secret_number = 5
3+
def draw_check(): ##Draws the green check mark
4+
right(45)
5+
color("green")
6+
pensize(10)
7+
backward(50)
8+
forward(50)
9+
left(90)
10+
forward(100)
11+
while int(input("Give a number (1-10): ")) != secret_number: ## Do not save the input as user_input. codehs crashed
12+
print("Try again")
13+
draw_check()
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
speed(0)
2+
secret_number = 5
3+
user_input = int(input("Give a number (1-10): "))
4+
def draw_check(): ##Draws the green check mark
5+
right(45)
6+
color("green")
7+
pensize(10)
8+
backward(50)
9+
forward(50)
10+
left(90)
11+
forward(100)
12+
while user_input != secret_number: ## Do not save the input as user_input. codehs crashed
13+
if user_input < secret_number: ## CodeHS compiler broke.
14+
print("guess higher!")
15+
else:
16+
print("guess lower!")
17+
draw_check()
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
speed(0)
2+
radius = 25
3+
count = 1
4+
row_value = int(input("How many circles (1-8) would you like on the bottom? "))
5+
x_value = -((row_value*(radius*2))/2)+25
6+
y_value = -225 + (count*radius)
7+
def moveup():
8+
setposition(x_value,y_value)
9+
penup()
10+
moveup()
11+
def draw_row():
12+
for i in range(row_value):
13+
pendown()
14+
circle(radius)
15+
penup()
16+
forward(radius*2)
17+
for i in range(row_value):
18+
draw_row()
19+
count = count + 1
20+
y_value = -225 + ((count*radius)*2)-25
21+
x_value = -((row_value*(radius*2))/2)+50
22+
moveup()
23+
row_value=row_value-1

CodeHS/2/19/6/Checkerboard-Travis.py

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
speed(0)
2+
setposition(-200,-200)
3+
def make_square(color_square): ##Creates one square 40x40 pixels with color color_square
4+
color(color_square)
5+
begin_fill()
6+
for i in range(4):
7+
forward(40)
8+
left(90)
9+
end_fill()
10+
def make_row(first_color, second_color): ## creates a row of 10 squares with alternating colors between first_color and second_color
11+
mod_check=0
12+
for i in range(10):
13+
if mod_check%2==0:
14+
make_square(first_color)
15+
else:
16+
make_square(second_color)
17+
forward(40)
18+
mod_check=mod_check+1
19+
def up_a_row(): ## moves tracy up a row
20+
penup()
21+
backward(400)
22+
left(90)
23+
forward(40)
24+
right(90)
25+
def make_two_rows(): ## makes a row with red,black and a row on top of it with black,red
26+
make_row("red", "black")
27+
up_a_row()
28+
make_row("black", "red")
29+
def make_checkerboard(): ##makes the checker board using make_two_rows and up_a_row
30+
for i in range(5):
31+
make_two_rows()
32+
up_a_row()
33+
make_checkerboard()
34+

CodeHS/2/5/5/Hexagon-Travis.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
for i in range(6):
2+
forward(50)
3+
left(60)
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
left(45)
2+
for i in range(4):
3+
left(90)
4+
forward(100)
5+
backward(100)

CodeHS/2/5/7/Circle-Pyramid-Travis.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
speed(0)
2+
penup()
3+
setposition(-100, -200)
4+
for i in range(3):
5+
pendown()
6+
circle(50)
7+
penup()
8+
forward(100)
9+
setposition(-50, -100)
10+
for i in range(2):
11+
pendown()
12+
circle(50)
13+
penup()
14+
forward(100)
15+
setposition(0, 0)
16+
pendown()
17+
circle(50)
18+
penup()
19+
forward(100)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
penup()
2+
setposition(-100, -200)
3+
## Makes the bottom three circles.
4+
for i in range(3):
5+
pendown()
6+
circle(50)
7+
penup()
8+
forward(100)
9+
setposition(-50, -100)
10+
## Makes the middle two circles.
11+
for i in range(2):
12+
pendown()
13+
circle(50)
14+
penup()
15+
forward(100)
16+
"""
17+
Makes the last circle.
18+
"""
19+
setposition(0, 0)
20+
pendown()
21+
circle(50)
22+
penup()
23+
forward(100)
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
speed(0)
2+
def make_half_bracelet():
3+
for i in range(18):
4+
left(10)
5+
penup()
6+
forward(100)
7+
pendown()
8+
circle(10)
9+
penup()
10+
backward(100)
11+
for i in range(2):
12+
make_half_bracelet()

CodeHS/2/8/5/Shape-Stack-Travis.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
speed(0)
2+
penup()
3+
setposition(-25, -200)
4+
def square_circle_stack():
5+
pendown()
6+
for i in range(4):
7+
forward(50)
8+
left(90)
9+
penup()
10+
left(90)
11+
forward(50)
12+
right(90)
13+
forward(25)
14+
pendown()
15+
circle(25)
16+
penup()
17+
backward(25)
18+
left(90)
19+
forward(50)
20+
right(90)
21+
for i in range(4):
22+
square_circle_stack()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
speed(0)
2+
pensize(5)
3+
color("red")
4+
penup()
5+
backward(100)
6+
pendown()
7+
forward(200)
8+
penup()
9+
left(120)
10+
for i in range(4):
11+
pendown()
12+
color("blue")
13+
forward(50)
14+
left(120)
15+
color("green")
16+
forward(50)
17+
right(120)

0 commit comments

Comments
 (0)