Learning Objective: Know how computers execute instructions in a sequence
PREDICT
What will this program do when run? Write down your predictions.
Demo
How to run programs in Python IDLE
RUN
Try running the program using the link below.
Did it perform as expected?
https://trinket.io/turtle/4bf49c078b
SEQUENCING
Programs run in the order that they are written. The first line is executed first and then the second line and so on.
It is really important to get the program lines in the correct order, otherwise the program will have unexpected results
INVESTIGATE
Our program is split in to lines, which are numbered. Python (the programming language) will execute each line of code in the order it is written.
It will start with the first line and finish on line 6.
On line 1 and 2 we are setting up the turtle to
be used.
On line 4-6 we are giving it movement
instructions.
INVESTIGATE
What happens if we re-order the instructions? Does the same thing happen?
What do the numbers in the brackets mean? What happens if we change them?
Change the numbers to negative values.
Is there a backward command? Try using it.
Change the name of the turtle on line 2 from t to something else. What happens?
MODIFY
Amend the program so that it draws the following shapes:
Square
Triangle
Rectangle
Pentagon
A shape of your choice
MAKE
Create a Python program that:
Write your name on the canvas
REVIEW
Reorder this program so that it is properly sequenced.
It should draw a triangle.