0% found this document useful (0 votes)
2 views4 pages

Practicals Yr 8

The document discusses turtle programming in Python, focusing on the use of sequencing and iteration to create 2D shapes. It provides examples of drawing shapes using specific commands and demonstrates how iteration can simplify the process of creating repeated patterns. The examples include drawing a triangle and a square using the turtle graphics library.

Uploaded by

Nelly Chantal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

Practicals Yr 8

The document discusses turtle programming in Python, focusing on the use of sequencing and iteration to create 2D shapes. It provides examples of drawing shapes using specific commands and demonstrates how iteration can simplify the process of creating repeated patterns. The examples include drawing a triangle and a square using the turtle graphics library.

Uploaded by

Nelly Chantal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 4

ALGORITHMS AND

TURTLE
PROGRAMMING
TURTLE PROGRAMMING PRACTICALS
(Trinket compiler)
Using sequencing in python
The examples of 2D shapes in the previous topic are based on sequence
Import turtle
marker=turtle. Turtle()
marker.pencolor(“red”)
marker.fd(200)
marker.lt(120)
marker.fd(200)
marker.lt(120)
marker.fd(200)
Example 2
Import turtle
marker=turtle. Turtle()
marker. Pencolor(“green”)
marker. Fd(200)
marker.rt(90)
marker. fd(200)
marker.rt(90)
marker. Fd(100)
marker.rt(90)
marker.fd(100)
marker.rt(90)
marker.fd(100)
marker.rt(90)
marker.fd(100)
Using iteration in python
Iteration in python is ideal for repeated patterns or shapes created by repeating a command. For
example, the creation of a squire
e.g.
#iteration squire
import turtle
marker=turtle. Turtle ()
marker. pencolor(“blue”)
for line in range (4):
marker. fd (100)
marker (90)
The result 2D graphic will be a squire

You might also like