Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CodeHS Python Variables

Total questions: 8

Worksheet time: 4mins

Name
Class
Date
1.

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.

2.

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

a)

:

b)

*

c)

=

d)

==

3.

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

4.

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

5.

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

6.

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

a)

s

b)

hs

c)

score

d)

highScore

7.

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

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