How to draw Olympics logo in Python Turtle?

Olympics logo is made up of five interlaced rings having the following colors- blue, black, red, yellow and green. The basic logic of drawing it is using the proper combination of goto() and circle() function.

#Python Program to draw Olympics logo in Turtle Programming
import turtle

t = turtle.Turtle()
t.pensize(6) #Set the thickness of the pen to 6
firstRowColors = ["blue", "black", "red"] #firstRowColors is a list of colors that are present in the first row of logo
for i in range(3):
  t.penup()
  t.pencolor(firstRowColors[i])
  t.goto(i*110, 0)
  t.pendown()
  t.circle(50)

secondRowColors = ["", "yellow", "", "green"]
for i in range(1, 4, 2):
  t.penup()
  t.pencolor(secondRowColors[i])
  t.goto(i*55, -50)
  t.pendown()
  t.circle(50)

Output of the above program

Olympics logo in Python Turtle

Explanation of the above code-

import turtle
olympics = turtle.Turtle()

To draw any shape using Turtle, you have to import turtle module. After this, create a new drawing board and assign it to an object t.

firstRowColors = ["blue", "black", "red"]
for i in range(3):
  t.penup()
  t.pencolor(firstRowColors[i])
  t.goto(i*110, 0)
  t.pendown()
  t.circle(50)

Colors are stored in a list and are applied to the turtle's pen based on the iteration. Here, we are moving the turtle to the desired position, and then drawing the circle of 50 units. This thing is repeated 3 times to obtain first row of Olympics logo.

secondRowColors = ["", "yellow", "", "green"]
for i in range(1, 4, 2):
  t.penup()
  t.pencolor(secondRowColors[i])
  t.goto(i*55, -50)
  t.pendown()
  t.circle(50)

The logic of the first row is applied for the second row.

How to draw Audi logo in Python Turtle?

#Python Program to draw Audi logo in Turtle Programming
import turtle

t = turtle.Turtle()
t.pensize(4)

for i in range(4):
  t.penup()
  t.goto(i*70, 0)
  t.pendown()
  t.circle(50)

Output of the above program

Audi logo in Python Turtle

Explanation of the above code-

for i in range(4):
  t.penup()
  t.goto(i*70, 0)
  t.pendown()
  t.circle(50)

Recommended Posts