WorksheetsPython Graphics
Total questions: 10
Worksheet time: 5mins
What is Turtle graphics in Python?
A type of computer game.
A feature that allows users to write text
A method for creating 3D animations in Python
A feature that allows users to create images using a turtle that can move around the screen based on simple commands.
How can you draw a SQUARE using Turtle graphics & loop?
import turtle
# Create turtle object
t = turtle.Turtle()
for i in range(4):
t.forward(100)
t.right(90)
import turtle t = turtle.Turtle() t.forward(100) t.right(90) t.forward(100) t.right(90) t.forward(100) t.right(90)
import turtle
t = turtle.Turtle() t.forward(100)
t.left(90)
t.forward(100)
t.left(90) t.forward(100)
t.left(90)
import turtle t = turtle.Turtle() t.forward(100) t.right(90) t.forward(100) t.right(90) t.forward(100) t.right(90) t.forward(100)
How can you draw a CIRCLE using Turtle graphics?
import turtle
t = turtle.Turtle() t.draw_circle(100)
import turtle
t = turtle.Turtle() t.circle(100)
import turtle
t = turtle.Turtle() t.create_circle(100)
import turtle
t = turtle.Turtle() t.draw_shape(100)
What are the primary shapes that can be drawn using Python graphics?
squares
rectangles, circles, lines
triangles
ovals
How can you draw a TRIANGLE using Turtle graphics?
import turtle # Create turtle object
t = turtle.Turtle() # Draw triangle
for i in range(3):
t.forward(100)
t.left(120)
import turtle t = turtle.Turtle() t.forward(100) t.left(120) t.forward(100) t.right(120) t.forward(100) t.left(120)
import turtle t = turtle.Turtle() t.forward(100) t.right(120) t.forward(100) t.right(120) t.forward(100) t.right(120)
import turtle t = turtle.Turtle() t.forward(100) t.left(120) t.forward(100) t.left(120) t.forward(100) t.left(120)
What are the different methods to move the Turtle in Python graphics?
forward(), backward(), right(), left()
move()
down()
rotate()
up()
How can you fill a shape with a specific color in Python graphics?
shape_object.fill_color('specific_color')
color_shape('specific_color')
{ shape_object.fill('specific_color') }
fill_shape('specific_color')
How can you draw a RECTANGLE using Turtle graphics?
Set the Turtle object to 'invisible' mode
Import 'pandas' library to draw a rectangle
Use the 'circle' method instead of 'forward' and 'right'
import turtle # Create Turtle object
t = turtle.Turtle() # Draw rectangle
for i in range(2):
t.forward(100)
t.right(90)
t.forward(50)
t.right(90)
What are the advantages of using Turtle graphics in Python?
Difficult for advanced users
Beginner-friendly, easy visualization of concepts, simple graphics and animations creation
Limited functionality
Requires external libraries
How can you create custom colors in Python graphics?
Use the RGB format to specify custom colors in Python graphics.
Use the CMYK format to specify custom colors in Python graphics.
Use the HEX format to specify custom colors in Python graphics.
Use the HSL format to specify custom colors in Python graphics.
