## 1. Importing turtle

The turtle library stores all of the code to create and move an object called a turtle

â€‹

The turtle library must be imported into your Python program before you can use it to draw lines, shapes and colours.

Task 1 - Create a new Python program and save the file as Python-Turtle.py

â€‹

Copy the import turtle code at the start of your program.

## 2. Basic Shapes

The turtle can be controlled by writing how many pixels it should travel forward and the angle it should point left or right.

## Moving Forwards

turtle.forward(100) will move the turtle forward by 100 pixels.

â€‹

turtle.forward(200) will move the turtle forward by 200 pixels.

â€‹

â€‹

â€‹

â€‹

When using the left command or the right command, the turtle won't actually move, but it will rotate by the number of degrees that you state.

â€‹

For example, typing turtle.left(90) will point the turtle upwards.

## Rotating Left & Right

Copy the code to the right to make the turtle draw a square.

â€‹

Then, in new windows, try to make:

1. A Rectangle

2. A Triangle

3. A Pentagon

4. A Hexagon

## 3. Using Loops

You can use a for loop to repeat code.

â€‹

This is especially helpfully with intricate shapes with many sides.

â€‹

The code below will print a square but in only 3 lines instead of the 8 lines from task 2.

## Press the tab key once on your keyboard to indent your code.

Task 3 - Copy the code above to make the turtle draw a square using a loop.

â€‹

Then, in new windows, try to make:

• A Heptagon

• An Octagon

• A Circle

• A Pentagram (5-sided Star)

## Hint: To work out the angles, divide 360 by the number of sides.

Choose a background colour

window = turtle.Screen()

window.bgcolor("red")

Choose the line size and colour

turtle.pensize(6)

turtle.color("green")

Fill a shape

turtle.color("yellow")

turtle.begin_fill()

(put your turtle's directions in here)

turtle.end_fill()

â€‹

Lift the pen

turtle.penup()
turtle.pendown()

Speed up/Slow down the turtle

turtle.speed(speed=10)

Task 4 - Use the code above to make:

â€‹

• A blue square on a red background.

• A yellow triangle on a pink background.

• Two different coloured circles - not touching each other.

• Three different shapes of three different colours - not touching each other.

## Complex Shapes

â€‹

You could try:â€‹

• A Flower

• A Word (like your name - you will need to use the penup() and pendown() commands.

• A Christmas tree

• A Landscape (green ground, blue sky, yellow sun)â€‹