0% found this document useful (0 votes)
56 views

Turtle

The document defines functions to draw various shapes using the turtle module in Python. It draws a part 1, crown, O, part 2, 01, 02, 2, heart, and heart2 shape using turtle methods like forward, left, color, begin_fill and end_fill. The shapes are drawn by calling the corresponding functions.

Uploaded by

api-327825157
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

Turtle

The document defines functions to draw various shapes using the turtle module in Python. It draws a part 1, crown, O, part 2, 01, 02, 2, heart, and heart2 shape using turtle methods like forward, left, color, begin_fill and end_fill. The shapes are drawn by calling the corresponding functions.

Uploaded by

api-327825157
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

import turtle drawP2()

turtle.shape("turtle") turtle.penup()
turtle.width(5) turtle.forward(170)
turtle.color("#6ba3ff") turtle.left(90)
turtle.fillcolor("#fffac9") turtle.forward(45)
turtle.bgcolor("#8b9184") turtle.pendown()

turtle.penup() def drawCROWN()


turtle.goto(-100,0) turtle.color("#6a03aa"
turtle.begin_fill()
turtle.right(180)
turtle.pendown() turtle.forward(90)
turtle.left(105)
def drawP1(): turtle.forward(45)
turtle.color("#f4d942") turtle.left(130)
turtle.begin_fill() turtle.forward(35)
turtle.forward(50) turtle.right(120)
turtle.left(90) turtle.forward(35)
turtle.forward(50) turtle.left(130)
turtle.left(90) turtle.forward(35)
turtle.forward(50) turtle.right(120)
turtle.left(90) turtle.forward(35)
turtle.forward(50) turtle.left(130)
turtle.forward(50) turtle.forward(45)
turtle.end_fill() turtle.end_fill()

drawP1() drawCROWN()

turtle.penup() turtle.penup()
turtle.left(90) turtle.right(40)
turtle.forward(75) turtle.forward(75)
turtle.pendown() turtle.left(30)
turtle.forward(35)
def drawO(): turtle.pendown()
turtle.color("#f47718")
turtle.begin_fill() def draw1():
turtle.forward(50) turtle.color("#266cef")
turtle.left(90) turtle.begin_fill()
turtle.forward(100) turtle.left(115)
turtle.left(90) turtle.forward(45)
turtle.forward(50) turtle.end_fill()
turtle.left(90)
turtle.forward(100) draw1()
turtle.end_fill()
turtle.penup()
drawO() turtle.right(90)
turtle.forward(15)
turtle.penup() turtle.pendown()
turtle.left(90)
turtle.forward(75) def draw01():
turtle.pendown() turtle.color("#5ccdf9")
turtle.begin_fill()
def drawP2(): turtle.forward(25)
turtle.color("#f20c04") turtle.right(90)
turtle.begin_fill() turtle.forward(45)
turtle.left(90) turtle.right(90)
turtle.forward(100) turtle.forward(25)
turtle.right(90) turtle.right(90)
turtle.forward(50) turtle.forward(45)
turtle.right(90) turtle.end_fill()
turtle.forward(50)
turtle.right(90) draw01()
turtle.forward(50)
turtle.end_fill() turtle.penup()
turtle.right(90)
turtle.forward(40) turtle.right(50)
turtle.pendown() turtle.forward(15)
turtle.right(78)
def draw02(): turtle.forward(10)
turtle.color("#129941") turtle.left(100)
turtle.begin_fill() turtle.forward(25)
turtle.forward(25) turtle.right(30)
turtle.right(90) turtle.forward(10)
turtle.forward(45) drawheart2()
turtle.right(90)
turtle.forward(25) turtle.end_fill()
turtle.right(90)
turtle.forward(45) turtle.pendown()
turtle.end_fill()
turtle.done()
draw02()
turtle.penup()
turtle.right(90)
turtle.forward(40)
turtle.pendown()

def draw2():
turtle.color("#a8d865")
turtle.forward(25)
turtle.right(90)
turtle.forward(20)
turtle.right(90)
turtle.forward(25)
turtle.left(90)
turtle.forward(25)
turtle.left(90)
turtle.forward(20)

draw2()

turtle.penup()
turtle.forward(20)
turtle.left(90)
turtle.pendown()

def drawheart():
turtle.color("#a8d865")
turtle.forward(30)
turtle.right(50)
turtle.forward(15)
turtle.right(78)
turtle.forward(10)
turtle.left(100)
turtle.forward(25)
turtle.right(30)
turtle.forward(10)

drawheart()

turtle.penup()
turtle.right(100)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(120)
turtle.pendown()

def drawheart2():
turtle.color("#a8d865")
turtle.forward(30)

You might also like