Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Variables

Total questions: 8

Worksheet time: 4mins

Name
Class
Date
1.

What rule is the following variable name BREAKING?


StudentNo.

a)

Only use text for the starting letter of a variable name - not numbers at the start

b)

No special symbols other than the underscore

c)

There is nothing wrong with this variable name

d)

Keep variable names meaningful for the task they are being used for

2.

What is the variable name in the following script?

a)

name

b)

hello, your name is

c)

print

d)

There is no variable in this script

3.
The correct way to write a variable in Python?
a)
myVariable = 10
b)
my Variable = 10
c)
myVariable is 10
d)
myVariable: 10
4.

What symbol is used in python to assign values to a variable?

a)

:

b)

*

c)

=

d)

==

5.

What rule is the following variable name BREAKING:


1st_Name

a)

No special characters other than underscore

b)

Only use text for the start of the variable name - no numbers at start

c)

Keep names meaningful

d)

There is nothing wrong with this variable name

6.

What is a variable?

a)

A number

b)

A message input by the user

c)

A location in memory that we use to store data

d)

A printout that show answer that user entered.

7.

Which name would be meaningful in keeping a record of someone's high score?

a)

s

b)

hs

c)

score

d)

highScore

8.

Looking at the following code, what are the names of the variables:

a)

TotalBill, No_Diners, Share

b)

Total_Bill, No_Diners, Share

c)

print, format, input

d)

float, int, input