Page 18 - 2501_KVS_C-6
P. 18
Then, click on the File tab and select the Save option. This will open the Save As dialog box.
Choose the location where you want to save your file and enter a name for it. After that,
click on the Save button.
Once saved, click on the Run tab and select Run Module or press F5 key. The Python Turtle
Graphics window will then open, displaying the output of your program.
Output:
Gowri: I told the turtle (pen) to move 100 points (pixels) in the direction it was facing, so it
drew the first line.
Syntax
You can use the following syntax to move and turn the turtle (pen):
<pen_name>.forward(distance)
You can name the pen anything you like: pen, t, my_turtle, etc.
Now let me explain how you can move and change the direction of the turtle (pen) on the
drawing board, i.e., the canvas:
Turtle.forward(n) – To move the turtle forward by given points
Ø
e.g. pen.forward(100)
Turtle.backward(n) – To move the turtle backward by given points
Ø
e.g. pen.backward(100)
Turtle.left(degree) – To change the direction of turtle to left by given angle
Ø
degree
e.g. pen.left(90)
Turtle. right(degree) – To change the direction of turtle to right by given angle
Ø
degree
e.g. pen.right(90)
16 KVS DELHI REGION 2025

