< Back
Page 9 of 9
This chapter is from the book
Workshop
Quiz
- The print function is part of the Python standard library and is considered a built-in function. True or false?
- When is a variable created and assigned a data type?
- A(n) __________ sequence enables a Python statement to “escape” from its normal behavior.
Which of the following is a valid Python escape sequence?
- //
- \'
- ESC
- Which Python escape sequence will insert a linefeed in output?
- A comment in a Python script should begin with which character?
Which of the following is a valid Python data type?
- int
- input
- Which function enables you to view a variable’s data type?
- If a variable is assigned the number 3.14, which data type will it be assigned?
- The input function is part of the Python standard library and is considered a built-in function. True or false?
Answers
- True. The print function is a built-in function of the standard library. There is no need to import it.
- A variable is created and assigned a data type when it is assigned a value. The value and data type for a variable can be changed with a reassignment.
- An escape sequence enables Python statement to “escape” from its normal behavior.
- b. \' is a valid Python escape sequence. Refer to Table 4.1 for a few valid Python escape sequences.
- The \n Python escape sequence will insert a linefeed in output.
- A comment in a Python script should begin with the pound or hash symbol (#) for the Python interpreter to ignore it.
- a. int is a Python data type. input and print are both Python functions. Refer to Table 4.2 for a refresher on the data types.
- The type function enables you to view a variable’s data type.
- If a variable is assigned the number 3.14, it will be assigned the float data type by Python. Refer to Table 4.2 for data types.
- True. The input function is a built-in function of the standard library. There is no need to import it.
< Back
Page 9 of 9