WorksheetsPython Year 8
Total questions: 60
Worksheet time: 30mins
name = "Bob"
if name == "Bob":
print ("Hello " + name)
else:
print ("I dont know you")
which of these are a correct print statement
Print("Computer science")
prit ("Computer science")
print (Computer science")
print ("Computer science")
I am used multiple times in a program; I can be changed and stored in memory. I am a ? ONE WORD ANSWER.
(a)
Which line in this program is incorrect?
if 9 > 8:
Print ("Correct")
else:
print ("Incorrect")
Line 1
Line 2
Line 3
Line 4
print("Hello world!")
To display something on the screen, use this command:
print()
Print()
screen()
write()
display()
To display the following on screen
Hello World!
the following command should be used:
print(Hello World!)
print("Hello World!")
print("Hello World" + !)
print"(Hello World!)"
cakeAmount = raw_input()
print "We have", cakeAmount, " cakes"
The above code is run. You type:
six
Select the correct output.
We have six cakes
We have 6 cakes
We havesix cakes
Syntax Error
Which is the Python logo?
What is a input?
A function that allows us to ask the user to enter some data.
To plug in something.
Data displayed on a screen.
A function
What is a output?
A piece of data that is shown on the screen.
Data that the user enters
An output
A orange
What function is used to output a message in python?
print("")
input=name
name=input
What syntax would you use to create a name variable?
name=input()
input=name
name=input{}
name=INPUT
people = ["John", "Rob", "Bob"]
print (people[4])
what would this result be?
To display the following on screen
Hello World!
the following command should be used:
print(Hello World!)
print("Hello World!")
print("Hello World" + !)
print"(Hello World!)"
Which operator performs a division?
-
+
/
*
Which operator checks if a value is equal to another value?
+
=
==
!=
Which of the following is used in Python to give a value to a variable
:=
==
=
print(1+2)
what will the result be
error
3
1+2
To make the turtle move forward, which command is used?
turtle.penup()
turtle.forward()
turtle.left()
turtle.backward()
When creating a rectangle with the turtle, what angle is needed when turning?
120
180
45
90
In order to move the turtle 120 forward without drawing on the screen, which order is correct?
turtle.forward(120)
turtle.penup()
turtle.pendown()
turtle.pendown()
turtle.forward(120)
turtle.penup()
turtle.penup()
turtle.forward(120)
turtle.pendown()
To fill a shape with the colour red, which command is correct?
turtle.fillcolor('Red')
turtle.fillcolour('Red')
turtle.fillcolor("Red")
turtle.fillcolour("Red")
How do you tell python you want to use the turtle library
turtle import
import turtle
from libraries import turtle
from turtle import libraries
What does turn(90) do?
Turns right 90 degrees
Turns left 90 degrees
Moves forward 90
Does nothing as 'turn' is not a turtle instruction
Look at this code, how many times will it loop?
50
90
0
4
What shape will this create?
Triangle
Rectangle
Hexagon
Will look like the turtle is climbing stairs
What does t.forward(300) do?
Moves in the direction it is facing 300 steps
Moves down the screen 300 steps
Moves up the screen 300 steps
To stop the turtle drawing you need to use which of the following commands?
penup:
pen_up
penup()
penup():
There is an error on this piece of code, what is the correct statement?
screen.bgcolor("lightblue")
screen.bgcolor="lightblue")
screen.bgcolour("lightblue")
screen.bgcolor=lightblue()
What is wrong with this piece of code
Must use the American spelling of colour - "color"
Remove the prefix "screen." on Line 3
Don't write the name of the colour in quote marks
Don't add a capital letter to "Screen"
There is an error on this piece of code, what is the correct statement?
import turtle
import Turtle
import.Turtle
turtle import
There is an error on this piece of code, what is the correct statement?
turtle.forward(150)
turtle.forward()
turtle.moveforward()
turtle.move.forward(150)
There is an error on this piece of code, what is wrong?
Nothing
No full stop needed in the pen.down statement e.g. turtle.pendown()
No brackets needed in the pen.down statement e.g. turtle.pen.down
No turtle prefix needed in the pen.down statement e.g. pen.down()
There is an error on this piece of code, how should it be written?
There is no error
screen=turtle.screen()
screen=turtle.Screen()
screen=turtle.screen("blue")
There is an error on this piece of code, how should it be written?
There is no error
turtle.right(90)
turn.right(90)
right(90)
There is an error on this piece of code, how should it be written?
There is no error
turtle.right(90)
turtle.drawcircle(10)
import.turtle
There is an error on this piece of code, how should it be written?
There is no error
turtle.right(90)
turtle.drawcircle(10)
import.turtle
What shape will be the output from this code?
Square
Triangle
Circle
Rectangle
