https://coder.csuk.io/turtlecoder/
How does the turtle work(pixels and angles)?[discuss + experiment]
How could you tell a turtle to draw a square?[discuss]
How could we make that code simpler? [discuss + demo]
How to draw a cricle?
import turtle
import random
grumble = turtle.Turtle()
grumble.speed(5) # 1:slowest, 3:slow, 5:normal, 10:fast, 0:fastest
# SQUARE CODE
def square():
for i in range(4):
grumble.forward(30)
grumble.right(90)
# TRIANGLE CODE
def triangle():
for i in range(3):
grumble.forward(30)
grumble.right(120)
# CIRCLE CODE
def circle():
for i in range(360):
grumble.forward(1)
grumble.right(1)
# CIRCLE OF SQUARES
def circle_of_square():
for i in range(5):
square()
grumble.right(36)
triangle()
grumble.right(36)
# CIRCLE OF TRIANGLES
for i in range(100):
circle_of_square()
grumble.setx(random.randint(-200, 200))
grumble.sety(random.randint(-200, 200))