I know I don't need to introduce BMW as it is a very popular luxury car. Today we gonna draw the BMW logo in python. I know that you can draw it using a pencil and other tools like AutoCAD etc. But we are programmers we talk with computers so let's tell our computer to draw this logo for use with the help of python.
Module
The only module we will use is that turtle
Code:
import turtle as t
t.begin_fill()
t.fillcolor('#008ac9')
for i in range(50):
t.forward(4)
t.left(2)
t.right(-80)
t.forward(116)
t.right(-90)
t.forward(132)
t.end_fill()
t.penup()
t.pendown()
t.right(90)
for i in range(50):
t.forward(4)
t.left(-2)
t.right(80)
t.forward(116)
t.forward(-116)
t.right(90)
t.begin_fill()
t.fillcolor('#008ac9')
for j in range(45):
t.forward(-4)
t.left(-2)
t.right(-90)
t.forward(116)
t.end_fill()
t.right(180)
t.forward(116)
t.right(90)
for i in range(47):
t.forward(4)
t.left(-2)
t.done()
x = t.Turtle()
Comments
Post a Comment