Font size
WorksheetsPY4E chapter 2 quiz
Total questions: 20
Worksheet time: 13mins
What is True of Reserved words in Python? Select all that apply.
You cannot use them as variable names
There are hundreds of reserved words
if, class, def, None, True are examples of reserved words
If you try to use a reserved word as a variable name, you will get an error
Reserved words live in hotels
Identify the "good" or acceptable variable names from those below. Select all that apply.
hour_rate
num apples
times_2
3rd_place
#tag
What extension must you add to the end of a python file when saving?
.xlsx
.pptx
.docx
.py
Mneumonic names are (select all that apply)
descriptive of the content of the variable
easy to understand and remember
used to soften the ground, and very noisy
cause a sore throat and a cough
What does the print function do in python?
It's a variable.
It can input data.
It displays an output - like a string or integer
It loops the code.
This stores a piece of data, and gives it a specific name
variable
whitespace
interpreter
modulo
Tick ALL options that are true of a variable
every variable has a type or class
It is like a box that holds something
It cannot be changed
Python variables use snake_case
Python variables use camelCase
Why do we put a string of text inside the brackets of an input?
The input function can also be used as an output, but only one string at a time.
The input function can also be used as an output, with several strings at a time.
The string of text can be used to instruct the user as to what they must type in.
The string of text is required, to act as a wrapper for the input the user types in; otherwise the data will be invalid string data and go nowhere.
What is the class of the variable x?
x = input("Enter choice: ")
float
int
str
bool
What is the result of the following code:
>>> x = 3
>>> y = 7
>>> y // x
2.0
2.33333333333
2
What is the result of the following code:
>>> x = 3
>>> y = 7
>>> y % x
2.33333
2
1
0.5
What is the result of the following code:
>>> 3 + 2 ** 3 / 4 * 5
13
6.25
0.75
3.4
