wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Year 9 Python Revision

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.
Which function outputs data to the python shell?
a)
print()
b)
int()
c)
input()
d)
def
2.
Which function converts data to an integer
a)
print()
b)
int()
c)
input()
d)
def
3.
Which function takes a users input
a)
print()
b)
int()
c)
input()
d)
def
4.
Which function is used to create your own function
a)
print()
b)
int()
c)
input()
d)
def
5.
print("12"*3)
What would this print?
a)
36
b)
121212
c)
24
d)
12*3
6.
Which is the most appropriate data type for: 8,405,334
a)
Float
b)
Boolean
c)
Integer
d)
String
7.
x = int(input("Enter a Number"))
print(X)
Why won't this work?
a)
Brackets are in the wrong place
b)
Print should have a capital letter
c)
It should have two equals
d)
both x variables should be lower case
8.
Which of these is used for selection?
a)
if
b)
while
c)
for
d)
do
9.
Which of these is used for iteration?
a)
for
b)
if
c)
int
d)
print
10.

What in the name of the variable in this Python code?

a)

name

b)

input

c)

print

d)

("What is your name")

11.

Why is it important that was use comments in our code?

a)

They help the program run smoothly

b)

So that when we come back to the code we can understand what it is doing

c)

To help other people understand what is going on in our code

d)

To add more colours into our code

12.
In programming, what is iteration?
a)
The repetition of steps within a program
b)
The order in which instructions are carried out
c)
A decision point in a program
d)
Testing a program to make sure it works
13.
Which of the following symbols is used in Python to mean "Not equal to"?
a)
==
b)
!=
c)
<>
d)
><
14.
a)
5
4
3
2
1
b)
4
3
2
1
0
c)
5  4  3  2  1
d)
4  3  2  1  0
15.
Question Image

match the variables to descriptions

a)

rolls

1.

random integer between 1 and 6

b)

sixes

2.

running total aiming to reach 10

c)

dice

3.

counter which is incremented with each roll

16.

Which of the following pieces of code will convert a string variable into an integer variable (one that contains a number not text)?

a)

number = int(number)     

b)

name = input(“What is your name?)

17.
Look at this code, what shape will it make?
a)
Square
b)
Triangle
c)
Rectangle
d)
Hexagon 
18.
Look at this code, how many times will it loop?
a)
50
b)
90
c)
0
d)
4
19.
What will be the output from this code?
a)
A star with an orange outline
b)
A solid orange star
c)
A pentagon with an orange outline
d)
A solid orange pentagon
20.
Stores a piece of data, and gives it a specific name
a)
variable
b)
whitespace
c)
interpreter
d)
modulus