1. Introduction to Python Turtle Graphics.
Structure
- Chapter name.
- Numbers of tasks.
- Must watch video.
- Reminder.
- Tasks instructions.
- Do tasks.
- Complete.
SO WHAT IS A TURTLE ?
- Pre-install Python library.
- Enable users to create pictures and shapes.
- It is an onscreen pen that is used for drawing.
- Usually shaped like a turtle. Hence its name come from that.
- Mainly used to introduce newbies to the world of computer.
- Use commands to control the turtle.
WHY LEARN TURTLE ?
- Effective way to teach codding for beginners.
- Entertaining.
- Help programmers get a feel for programming with Python.
- Easy to explore on your own.
- Allow creativity.
There is a simple turtle program below, you can run this to have a general idea about turtle.
NOW PLEASE RUN THE PROGRAM !
from browser import document
import turtle
turtle.set_defaults(
turtle_canvas_wrapper = document['turtle-div'])
# DO NOT DELETE ABOVE THIS LINE
######## Write your code below
name = turtle.Turtle()
name.shape("turtle")
name.color("red")
name.speed(10)
for i in range(25):
name.circle(5*i)
name.circle(-5*i)
name.left(i)
# DO NOT DELETE BELOW THIS LINE
turtle.done()
