Python Turtle Instructions

Total Page:16

File Type:pdf, Size:1020Kb

Python Turtle Instructions

Python Turtle Instructions

Basic Turtle Instructions turtle.forward Go forward turtle.backward Go backward turtle.right Turn right turtle.left Turn left turtle.penup() Lifts the pen up so you can move the turtle without drawing turtle.pendown() Drops the pen back onto the screen so you can draw turtle.fillcolor(“Brown”) Changes the fill colour to brown(or other colour) turtle.pencolor(“Red”) Changes the pen colour to red (or other colour) turtle.begin_fill() Begins to fill the shape turtle.end_fill() End the filling sequence

Open “IDLE (Python GUI).

Each of the tasks bellows needs to be completed in a new Python document & saved using the task number as the file name.

Task 1 – draw a square with a red line & brown fill colour

import turtle turtle.fillcolor(“Brown”) turtle.begin_fill() turtle.pencolor(“Red”) turtle.forward (100) turtle.right (90) turtle.forward (100) turtle.right (90) turtle.forward (100) turtle.right (90) turtle.forward (100) turtle.end_fill()

Task 2

Draw a square with sides measuring 180, it needs to have a purple line & blue fill. Use the pen up & down commands to do it on one program.

Mr D A Scougall Python Tutrtle Workbook V1 Task 3 – draw a rectangle (Remember in a new Python document)

import turtle turtle.forward (150) turtle.right (90) turtle.forward (80) turtle.right (90) turtle.forward (150) turtle.right (90) turtle.forward (80)

Task 4

Write your own instructions for a rectangle with sides of 120 and 190, it needs to have a red line & orange fill. Remember to use pen up & down to have them both on one program.

Task 5 – draw a triangle (Another new document)

import turtle turtle.forward (150) turtle.right (120) turtle.forward (150) turtle.right (120) turtle.forward (150) turtle.right (120)

Task 6

Shape Number sides Internal angle Triangle 3 120 Square 4 90 Pentagon 5 72 Hexagon 6 60 Octagon 8 45 Decagon 10 36

Write programs for at least 4 other shapes shown in the table above, each one of them needs to have different colours.

Mr D A Scougall Python Tutrtle Workbook V1 Task 7

Now you have mastered the basics of drawing shapes using Turtle, it is time for a challenge.

Write a Python turtle program that can recreate the house shown below.

Task 8

Use the pen up & down commands to add some windows into the house

Your house could also do with having a garage on the side.

Add colour to the house also, a red roof, brown building, blue door & yellow garage.

OH no! I have no windows to look out of. Can you fix this?

Remember save your work.

Try it.

If it does not work, alter it slightly.

Mr D A Scougall Python Tutrtle Workbook V1

Recommended publications