Last active
September 22, 2020 03:35
-
-
Save LinusSkucas/42aafd0b4c9f74c8907df92570e5d088 to your computer and use it in GitHub Desktop.
TurtleStars Hack Club Workshop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import turtle | |
import random | |
t = turtle.Turtle() | |
t.speed(10) | |
t.pencolor("red") | |
def draw_square(side_length): | |
for i in range(0,4): | |
t.forward(side_length) | |
t.right(90) | |
def draw_star(side_length, angle, repeat): | |
for i in range(0, repeat): | |
t.forward(side_length) | |
t.right(angle) | |
def draw_hexagon(side_length): | |
for i in range(0, 6): | |
t.forward(side_length) | |
t.left(300) | |
t.penup() | |
t.backward(200) | |
t.pendown() | |
draw_square(300) | |
for i in range(0, 2): | |
t.penup() | |
t.left(90) | |
t.backward(100) | |
t.right(90) | |
t.forward(30) | |
t.pendown() | |
draw_star(50, 105, 24) | |
t.color("blue") | |
for i in range(0,2): | |
t.penup() | |
t.forward(random.randrange(100,120)) | |
t.left(90) | |
t.pendown() | |
draw_star(50, 105, 24) | |
t.color("green") | |
draw_hexagon(50) | |
t.color("red") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment