wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Strings and Variables

Total questions: 8

Worksheet time: 5mins

Name
Class
Date
1.

Which function outputs text to the terminal?

a)

write()

b)

print()

c)

output()

d)

type()

2.
What letter will be printed on the screen after running this code:
a)
e
b)
x
c)
t
d)
Nothing prints
3.
In the following code, "city" is an example of a what?
a)
List
b)
Loop
c)
Variable
d)
Array
4.
What output will this code produce?
a)
Exeter
b)
4
c)
6
d)
city
5.

What is Python?

a)

a programming language

b)

DTP software

c)

Spreadsheet software

d)

Code

6.

What is a Variable?

a)

A box(memory location) where you store values

b)

A value that remains the same throughout a program

c)

A value that loads when the program runs

d)

a type of memory

7.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

"Dave"

c)

name

d)

(name)

8.
What will the output be from the following code?
print("Hello world!")
a)
SyntaxError
b)
Hello world!
c)
"Hello world!"
d)
print(Hello world!)