Preview

1 - Variables and Movement

 1. Analyse the trinket below. You can play with it as well (press 'run'). Tina is a turtle that you can ....

  move using voice commands

  adopt

  control with python programming code

  bring to life

 2. What will happen if you change line 6 to tina.forward(200)? Feel free to play with the code as you test and learn!

  Tina will move backwards and go off the screen

  Tina will descend down towards the bottom of the screen

  Nothing. Tina will remain frozen

  Tina will move forward a whole lot more

 3. What do you need to add to the end of this program to complete the square?
#1 

tina.left(90)
tina.forward(50)

#2 
tina.forward(90)
tina.forward(50)

#3 
tina.left(90)
tina.left(50)

#4
tina(make square)
tina(make complete)

  #1

  #2

  #3

  #4

 4. Add a variable 'name' to the code as shown below. (on line 4). Analyse the whole code as shown. What will be displayed on the screen if you add line 4 and line 7 to the trinket you have been working on?
import turtle
tina = turtle.Turtle()
tina.shape('turtle')
name="Jonathan"
tina.penup()
tina.forward(20)
tina.write("It's Tina here - nice to meet you:"+name)
tina.backward(20)

  It's Tina here - nice to meet you: Jonathan

  It's Tina here - nice to meet you:"+name

  Error

  It's Jonathan here - nice to meet you: Tina

 5. What is missing from line 17 - that is needed to turn the final line the color/colour "green"?

  #3 Either option #1 or #2 will work

  #1 tina.color(color)

  #4 - None of these options will work

  #2 tina.color("green")

 6. On what line has a 'variable' been declared? (select from the given options).
import turtle
tina = turtle.Turtle()
tina.shape('turtle')
#note american spelling
color="green"

tina.left(90)
tina.forward(20)
tina.write("And now I am blue?")

tina.forward(20)
tina.color("blue")
tina.write("Now I am black!")


tina.forward(20)

tina.write("....................But my favourite color is:"+color)

  Line 16 - the word 'tina' is the variable

  Line 15 - the blank space is the variable

  Line 5 - color is the variable (and it's spelt using American spelling!)

  Line 1 - 'import' is the variable

 7. What is a variable? Provide a valid definition for this important computer programming term.

  All of the above statements are true.

  Variables are used to store information to be referenced and manipulated in a computer program

  Data values can be constant or variable. If values are variable they can be changed by the program and the user.

  Variables can be thought of as 'storage boxes' for values that we can later work with in the program

 8. We can tell Tina to go directly to a specific point on the graph. This makes it easy to teach her to draw something! What will happen if you add the following code to your program?
tina.goto(-300,300)
tina.write("This is -300, 300")

  It is outside the grid so Tina will go off screen!

  It will display "This is -300, 300" in the right place on the grid

  It will cause an error to occur

  It will overwrite one of the other text displays on the grid as 300 is a bigger number

 9. Tina can make circles of different sizes. Run the code to see a circle. If you added the following code to the bottom - what would happen?
tina.penup()
tina.goto(10,-10)
tina.pendown()
tina.circle(130)

  A second circle would overwrite the first

  A second circle of a much smaller size would be drawn in the same location

  A second circle of the same size would be drawn - in a different location (slightly off screen)

  A second circle of a much smaller size would be drawn in a different location (slightly off screen)

 10. Run the code, enter your name and run the program. Why will the code not display three small circles? Try and play with the code to make this work.

  Because the '30' in tina.goto(30,-150) needs to be changed to something else like 0 or 1.

  Because there is a negative number here which will cause an error: tina.goto(30,-150)

  Because the two numbers inside tina.goto(30,-150) need to both be much smaller to draw a smaller circle

  Because the number inside tina.circle(130) needs to be smaller for a smaller circle and the location coordinates also need to be changed