Three Overlapping Circles with Python and Turtle (Tutorial)

Draw the following overlapping circles. Please note that each circle passes through the center of the other two circles.

Three Overlapping Circles

Solution

We observe that the centers of the three circles form an equilateral triangle and the length of the equilateral triangle is the radius of the circle. So, the first step is to figure out the coordinates of the vertices of the equilateral triangle (with some math), and then draw three circles given the these three coordinates as the centers. So, it will be helpful to create a function that draws circle based on the center and radius. The following is the source code:

import turtle

screen = turtle.Screen()
screen.title('Three Circles - PythonTurtle.Academy')
screen.setup(1000,1000)
turtle.hideturtle()
turtle.speed(0)

def draw_circle(x,y,radius):
  turtle.up()
  turtle.goto(x,y-radius)
  turtle.seth(0)
  turtle.down()
  turtle.circle(radius,steps=360)

r = 150
draw_circle(0,r,r*3**0.5)
draw_circle(-r/2*3**0.5,-r/2,r*3**0.5)
draw_circle(r/2*3**0.5,-r/2,r*3**0.5)

What’s next?

Draw any number of overlapping circles.

One to Ten (Source Code)

Draw from a single point to ten points that fall into a single line. Also draw dots on the end points.

One to Ten

Source Code:

import turtle

turtle.setup(1000,1000)
turtle.title('One to Ten - PythonTurtle.Academy')
turtle.speed(0)
turtle.hideturtle()

turtle.color('green')

turtle.up()
turtle.goto(0,250)
turtle.dot('red')
for x in range(-450,460,100):
    turtle.up()
    turtle.goto(0,250)
    turtle.down()
    turtle.goto(x,-250)
    turtle.dot('blue')

Red Cross with Python Turtle (Source Code)

The following red cross with Python and Turtle. You need to fill it with a color.

Red Cross

Source Code:

import turtle

screen = turtle.Screen()
screen.title('Red Cross - PythonTurtle.Academy')
screen.setup(1000,1000)
turtle.speed(0)
turtle.hideturtle()
turtle.color('red')

turtle.up()
turtle.goto(-450,-150)
turtle.down()
turtle.begin_fill()
for _ in range(4):
    turtle.fd(300)
    turtle.right(90)
    turtle.fd(300)
    turtle.left(90)
    turtle.fd(300)
    turtle.left(90)      
turtle.end_fill()