0% found this document useful (0 votes)
7 views7 pages

Python Turtle Graphics Examples

The document contains several examples of Python programs using the Turtle graphics library to create various shapes and figures. It includes code snippets for drawing patterns, shapes, and text, as well as instructions for using specific Turtle functions. Additionally, it lists old questions and exercises related to programming concepts such as GCD, prime numbers, and Fibonacci sequences.

Uploaded by

loonay2002
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views7 pages

Python Turtle Graphics Examples

The document contains several examples of Python programs using the Turtle graphics library to create various shapes and figures. It includes code snippets for drawing patterns, shapes, and text, as well as instructions for using specific Turtle functions. Additionally, it lists old questions and exercises related to programming concepts such as GCD, prime numbers, and Fibonacci sequences.

Uploaded by

loonay2002
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Turtle

Eg1.
import turtle as t
[Link]("red")
[Link](3)
for i in range(50):
[Link](i * 5)
[Link](144)

Eg2.
import turtle
[Link]()
[Link](pencolor="green", pensize=3)
turtle.begin_fill()
for i in range(5):
[Link](150)
[Link](144)
[Link]("pink")
turtle.end_fill()
Eg3.
Write a Python program to print out the following Figure. You can use style = ("Arial", 15,
"italic") and [Link] ("Windows 10 LOGO !", font=style, align="center"). You can also use
penup ( ), pendown ( ), goto (90,-200) for starting the print out text and also use goto (100,-150)
for displaying yellow rectangle box, goto (100,-40) for displaying green rectangle box, goto (-
10,-40) for displaying red rectangle box and goto (-10,-150) for displaying blue rectangle box.
Moreover, you can also use color, begin_fill, end_fill, forward, left, hideturtle and done function.
Beside, define square( ) function for rectangle box. Otherwise, you can use your own idea for
creation.
import turtle
[Link]('white')
[Link](255)
def square():
for i in range (4):
[Link](100)
[Link](90)
#Display Text
[Link]()
[Link](90,-200)
[Link]("black")
style = ("Arial", 15, "italic")
[Link]("Windows 10 LOGO!", font=style, align="center")
#yellow box
[Link](90)
[Link]()
[Link](100,-150)
[Link]()
[Link]('yellow')
turtle.begin_fill()
square()
turtle.end_fill()
#green box
[Link]()
[Link](100,-40)
[Link]()
[Link]('green')
turtle.begin_fill()
square()
turtle.end_fill()
#red box
[Link]()
[Link](-10,-40)
[Link]()
[Link]('red')
turtle.begin_fill()
square()
turtle.end_fill()
#blue box
[Link]()
[Link](-10,-150)
[Link]()
[Link]('blue')
turtle.begin_fill()
square()
turtle.end_fill()
[Link]()
[Link]()

Eg4. Write a program to draw the following figure: ( 2023 Exam Question )
import turtle as t
[Link](10)
[Link]('yellow')
[Link]()
[Link]('grey')
radius=180
[Link]()
[Link](0,-radius)
[Link](0)
[Link]()
t.begin_fill()
[Link](radius)
t.end_fill()
mouth_radius=radius*0.6
mouth_angle=70
[Link]()
[Link](0,-mouth_radius)
[Link](0)
[Link]()
[Link](mouth_radius,mouth_angle)
[Link]()
[Link](0,-mouth_radius)
[Link](0)
[Link]()
[Link](mouth_radius,mouth_angle)
[Link]()
[Link](0,-mouth_radius)
[Link](0)
[Link]()
[Link](mouth_radius,-mouth_angle)
x=50
y=50
eye_size=60
[Link]()
[Link](x,y)
[Link]()
[Link](eye_size)
[Link]()
[Link](-x,y)
[Link](eye_size)
[Link]()
Eg5. Write a program to draw the following figure:
import turtle
screen=[Link]()
trtl=[Link]()
[Link](620,620)
[Link]('white')
[Link](4)
[Link]('turtle')
[Link]()
[Link]('red')
m=0
for i in range(12):
m=m+1
[Link]()
[Link](-30*i+60)
[Link](150)
[Link]()
[Link](25)
[Link]()
[Link](20)
[Link](str(m),align="center",font=("Arial", 12, "normal"))
if m==12:
m=0
[Link]()
[Link]()
[Link](0,-250)
[Link]()
[Link](10)
[Link]('black')
[Link](250)
[Link]()
[Link]()

Multiple choice questions, output, fill in the blank  old questions + text + knowledge
Programs:
[Link] Questions
[Link] I
[Link] II
[Link] example and exercise
Ch4 Ex 18,19
Ch5 Eg pattern , Ex pattern
Ch6 Eg setallite , Ex 4,5
Ch7 Eg Calculator
Ch8 Eg Calculator, Eg derivative

GCD, prime number, factorial, Fibonacci programs

You might also like