Python Programming Basics
- 138Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
138 questions
- 1Python is especially useful for writing scripts, automating tasks, and pursuing programming_____.
Hint
Think of the career opportunities mentioned alongside automation.
Answer
jobs
Explanation
The content describes Python as a popular language that is highly sought after for jobs, as well as useful for automation and scripts.
- 2Compared with many programming languages, Python is described as having relatively little_____to learn.
Hint
This refers to the rules for writing code in a language.
Answer
syntax
Explanation
The course introduction emphasizes that Python has less syntax to learn than many languages, which can make it more beginner friendly.
- 3Of the two major Python versions discussed, Python_____is the older legacy version.
Hint
It is contrasted with the version described as the future of Python.
Answer
Python 2
Explanation
Python 2 is described as a legacy version that is no longer officially maintained or supported.
- 4The version described as actively maintained and supported going forward is_____.
Hint
It is the newer version selected for the course.
Answer
Python 3
Explanation
Python 3 is presented as the future of Python and the version receiving ongoing maintenance and support.
- 5The course chooses_____as the version beginners should use for its examples.
Hint
The course selects the newer, actively supported version.
Answer
Python 3
Explanation
The tutorials use Python 3, while noting that learning it also helps a programmer transition to Python 2.
- 6Python 2 was said to have more existing libraries and_____written for it.
Hint
This refers to the amount of software already created in that version.
Answer
Python code
Explanation
The content notes that Python 2 had been around longer, so more libraries and Python code had been written for it.
- 7Learning Python 3 still makes it possible to move into coding in_____.
Hint
The course says the differences between the two versions are not very large.
Answer
Python 2
Explanation
The content explains that the version differences are relatively small, so a learner of Python 3 can also code in Python 2.
- 8An IDE is an integrated development_____used to write, run, and debug code.
Hint
The final word in the expansion of IDE names a workspace for development.
Answer
environment
Explanation
IDE stands for integrated development environment, a specialized program for working with code.
- 9The IDE selected for the course is_____.
Hint
It is a popular Python IDE from JetBrains.
Answer
PyCharm
Explanation
The tutorials use PyCharm as their integrated development environment.
- 10PyCharm's Community version is described as free and_____source.
Hint
This describes software whose source code is available for use and modification.
Answer
open
Explanation
The course selects the Community version because it is free and open source; the Professional version is paid.
- 11When creating a PyCharm project for this course, the selected interpreter should be_____.
Hint
The interpreter determines which Python version runs the project.
Answer
Python 3
Explanation
Selecting Python 3 as the project interpreter is necessary to follow the course's examples correctly.
- 12The command-line tool described as a package manager for installing Python modules is_____.
Hint
It is commonly used with an install command to add packages.
Answer
pip
Explanation
pip can install, manage, update, and uninstall Python modules, including third-party packages.
- 13In Python, a program is fundamentally a set of_____for the computer.
Hint
These tell the computer what actions to perform.
Answer
instructions
Explanation
Programming is described as specifying instructions that a computer executes to carry out tasks.
- 14A Python program executes its written lines of code in_____.
Hint
Changing the placement of a line can change when it runs.
Answer
order
Explanation
Python executes program instructions sequentially, so the order in which lines are written matters.
- 15The Python function used in the examples to display text or other output is_____.
Hint
It sends output to the screen or console.
Answer
print
Explanation
A print statement displays its contents, such as a message or a drawn text shape, in the console.
- 16The window where Python outputs information from print statements is the_____.
Hint
It is the output area shown below the editor in the examples.
Answer
console
Explanation
The console displays information produced by a running program, including text printed by print.
- 17In PyCharm, a new source file for a Python program is created as a_____file.
Hint
It uses the language's source-file type.
Answer
Python
Explanation
The course creates a new Python file in the project before writing its first program.
- 18The sample program that prints a conventional introductory greeting is called_____.
Hint
It is a traditional first program in many programming courses.
Answer
hello world
Explanation
The hello world program demonstrates a basic use of print to display a message.
- 19In Python, creating a text-based triangle with multiple print statements demonstrates that output can be_____from text.
Hint
The programmer describes the shape using the characters and spacing to display.
Answer
specified
Explanation
The example draws a shape by specifying its rows as strings inside print statements.
- 20A Python instruction inside a function or control structure is marked by_____.
Hint
Python uses leading whitespace to show code blocks.
Answer
indentation
Explanation
Indented lines belong to the block introduced by a function, loop, or conditional statement.
- 21A line beginning with the hash symbol is treated by Python as a_____.
Hint
It is written for people reading the code and is not executed.
Answer
comment
Explanation
Python ignores a comment beginning with the hash symbol during program execution.
- 22Temporarily making Python ignore a line without deleting it is called_____out the code.
Hint
This uses a comment marker to disable code during testing.
Answer
commenting
Explanation
Commenting out code preserves it in the file while preventing Python from executing it.
- 23A variable is a container used to store a data_____.
Hint
It is information that the program may later retrieve or change.
Answer
value
Explanation
Variables provide named containers for storing data used in a program.
- 24Using variables for a character's name and age avoids changing each repeated value_____throughout a long story.
Hint
A variable lets repeated references update from one stored value.
Answer
manually
Explanation
Storing a name or age once in a variable makes it easier to update every use throughout a program.
- 25In Python variable names, the course recommends separating words with an_____.
Hint
It is the character used in names such as character name.
Answer
underscore
Explanation
The examples use an underscore between words in variable names, such as character name and character age.
- 26The assignment operator used to give a variable a value is_____.
Hint
It is the symbol used between a variable name and its value.
Answer
equals
Explanation
An equals sign assigns the value on its right to the variable on its left.
- 27A variable's value can be changed later by assigning it a_____value.
Hint
For example, a character's name could change partway through a story.
Answer
new
Explanation
Reassigning a variable updates the value it stores, so later references use the new value.
- 28The Python data type used to store plain text is a_____.
Hint
Names and story text are common examples.
Answer
string
Explanation
A string represents plain text and is written inside quotation marks in the examples.
- 29Whole numbers and decimal numbers are both examples of the basic data type_____.
Hint
This data type supports values such as an age or a decimal measurement.
Answer
numbers
Explanation
The content identifies numbers, including whole and decimal numbers, as one of Python's basic data types.
- 30A value that can be either true or false is a_____value.
Hint
It is commonly used to represent yes-or-no conditions.
Answer
Boolean
Explanation
Boolean values represent true or false information and are frequently used in programming.
- 31The three basic data categories emphasized for new Python programmers are strings, numbers, and_____values.
Hint
This category represents true-or-false data.
Answer
Boolean
Explanation
The course highlights strings, numbers, and Boolean values as the basic types beginners will often use.
- 32A string is created by enclosing text in_____marks.
Hint
Python uses these marks to identify the beginning and end of a text literal.
Answer
quotation
Explanation
Quotation marks designate text as a string in Python.
- 33The escape sequence described as inserting a new line in a string is backslash followed by the letter_____.
Hint
The character stands for a new line.
Answer
n
Explanation
The backslash n escape sequence inserts a line break into a string.
- 34To include a quotation mark inside a string without ending the string, use the backslash as an_____character.
Hint
It tells Python to render the following character literally.
Answer
escape
Explanation
The backslash is an escape character; for example, it can make a quotation mark part of the string.
- 35Combining a string with another string by appending it is called_____.
Hint
The operation joins text values together.
Answer
concatenation
Explanation
Concatenation appends one string to another, such as adding a phrase to a stored string.
- 36In the examples, the string method that converts text to lowercase is_____.
Hint
It changes all letters to the smaller letter case.
Answer
lower
Explanation
The lower method returns a lowercase form of the string.
- 37The string method that converts all letters to uppercase is_____.
Hint
It changes all letters to capital letters.
Answer
upper
Explanation
The upper method returns an uppercase form of the string.
- 38The string method that checks whether all letters are uppercase returns a_____or false value.
Hint
It reports a yes-or-no result about the string's letter case.
Answer
true
Explanation
The is upper method returns true when the string is entirely uppercase and false otherwise.
- 39The built-in function used to find how many characters are in a string is_____.
Hint
The name abbreviates the idea of length.
Answer
len
Explanation
The len function returns the number of characters in a string.
- 40Python string indexing starts with position_____for the first character.
Hint
The first position is not numbered one in Python.
Answer
zero
Explanation
Python uses zero-based indexing, so the first character is at index zero.
- 41The string method that finds the position where a specified character or substring starts is_____.
Hint
It returns the location of a search value in the string.
Answer
index
Explanation
The index method reports the position of a specified value; it raises an error if that value is not found.
- 42The string method that substitutes one specified piece of text for another is_____.
Hint
It takes the old text and the new text as inputs.
Answer
replace
Explanation
The replace method returns a string in which the specified text has been changed to replacement text.
- 43The arithmetic operator that returns the remainder after division is the_____operator.
Hint
For example, ten divided by three leaves a remainder of one.
Answer
modulus
Explanation
The modulus operator returns the remainder from dividing the first number by the second.
- 44The function that converts a value to a whole-number type is_____.
Hint
It cannot preserve a decimal part when converting to an integer.
Answer
int
Explanation
The int function converts a suitable value to an integer, a whole number without a decimal part.
- 45The function used to convert a value to a decimal number type is_____.
Hint
It allows a number to have a fractional part.
Answer
float
Explanation
The float function converts a suitable value to a decimal number type.
- 46When a number must be joined with text for output, it can first be converted to a string with_____.
Hint
This function changes a value's type to text.
Answer
str
Explanation
The str function converts a number to a string so it can be combined with text for output.
- 47The function that returns a number's distance from zero, ignoring its sign, is_____.
Hint
It gives the absolute value of a number such as negative five.
Answer
abs
Explanation
The abs function returns the absolute value, so the absolute value of negative five is five.
- 48The function that raises a base number to a specified power is_____.
Hint
It accepts a number and an exponent.
Answer
pow
Explanation
The pow function can calculate a value such as three raised to the second power.
- 49The function that returns the larger of the values passed to it is_____.
Hint
It selects the greatest value among its inputs.
Answer
max
Explanation
The max function returns the largest value passed to it.
- 50The function that returns the smallest of the values passed to it is_____.
Hint
It selects the least value among its inputs.
Answer
min
Explanation
The min function returns the smallest value passed to it.
- 51The function that rounds a number according to standard rounding rules is_____.
Hint
A decimal part such as point seven rounds upward in the example.
Answer
round
Explanation
The round function rounds a number to a nearby whole number using standard rounding rules.
- 52The math function that discards the decimal part by rounding downward is_____.
Hint
It returns the lower whole-number value.
Answer
floor
Explanation
The floor function rounds down to the lowest whole-number value, effectively removing the fractional portion in the examples.
- 53The math function that rounds a number upward is_____.
Hint
It moves a non-whole value up to the next whole number.
Answer
ceil
Explanation
The ceil function rounds a number up to the next whole-number value.
- 54The math function used to calculate the square root of a number is_____.
Hint
For example, it returns six when given thirty-six.
Answer
sqrt
Explanation
The sqrt function returns the square root of its input.
- 55Python code uses an_____to request information from a user.
Hint
This function can display a prompt and wait for a response.
Answer
input
Explanation
The input function lets a user type information into a running program.
- 56By default, the value returned by input is a_____.
Hint
This remains true even if the user types digits.
Answer
string
Explanation
Python treats user input as text by default, so it must be converted when a number is needed.
- 57A list is a data structure used to store multiple_____in an organized way.
Hint
These can be related items such as friends' names or lucky numbers.
Answer
values
Explanation
Lists group multiple values together so a program can organize and manage them.
- 58Python list literals are enclosed in square_____.
Hint
They appear on both sides of the list's elements.
Answer
brackets
Explanation
Square brackets identify a list literal in Python.
- 59The first element of a Python list has index_____.
Hint
Python uses the same starting index for strings and lists.
Answer
zero
Explanation
List indexes are zero-based, so the first element is at position zero.
- 60In a list, an index of negative one accesses the_____element.
Hint
Negative indexes count from the end of the list.
Answer
last
Explanation
A negative one index selects the last element, while other negative indexes move backward from it.
- 61A list slice with a start and stop index includes the start but does not include the_____index.
Hint
The ending boundary is excluded from the selected slice.
Answer
stop
Explanation
Python list slicing includes the starting index and stops before the specified ending index.
- 62A list element can be changed by assigning a new value at its_____.
Hint
The position identifies which item to update.
Answer
index
Explanation
Lists are mutable, so a program can assign a new value to an element at a chosen index.
- 63The list method that adds another list's elements to the end of a list is_____.
Hint
It takes a collection of additional items.
Answer
extend
Explanation
The extend method appends the elements of another iterable, such as a list, to the current list.
- 64The list method that adds one element to the end of a list is_____.
Hint
Unlike extend, it adds a single item.
Answer
append
Explanation
The append method adds one element at the end of a list.
- 65The list method that inserts an element at a chosen position is_____.
Hint
It takes an index and the new element.
Answer
insert
Explanation
The insert method places an element at a specified index and shifts later elements to make room.
- 66The list method that removes a specified matching value is_____.
Hint
It identifies the item by its value rather than its position.
Answer
remove
Explanation
The remove method removes the specified value from a list.
- 67The list method that empties a list by removing all of its elements is_____.
Hint
It resets the list to an empty state.
Answer
clear
Explanation
The clear method removes every element from the list.
- 68The list method that removes and returns the last element by default is_____.
Hint
Its name suggests taking an item off the list.
Answer
pop
Explanation
The pop method removes the last element from a list by default and returns that element.
- 69The list method that returns the position of a specified value is_____.
Hint
It can be used to check where a value such as a friend's name appears.
Answer
index
Explanation
The index method returns the index of a value in a list and raises an error if the value is absent.
- 70The list method that counts how many times a value occurs is_____.
Hint
It is useful when the same value appears more than once.
Answer
count
Explanation
The count method returns the number of occurrences of a specified value in a list.
- 71The list method that orders items into ascending order is_____.
Hint
For text, this can arrange names alphabetically.
Answer
sort
Explanation
The sort method orders a list's elements in ascending order.
- 72The list method that reverses the current order of elements is_____.
Hint
The first item becomes last and the last becomes first.
Answer
reverse
Explanation
The reverse method reverses the order of elements in a list.
- 73The list method that creates a shallow copy of a list is_____.
Hint
It provides a separate list containing the same elements.
Answer
copy
Explanation
The copy method creates a copy of a list's contents.
- 74A tuple differs from a list because a tuple is_____after it is created.
Hint
Its elements cannot be changed, added, or removed.
Answer
immutable
Explanation
Tuples are immutable, whereas lists can be modified after creation.
- 75A tuple is typically created using parentheses and stores multiple_____.
Hint
Coordinates are one example of the data tuples can hold.
Answer
values
Explanation
Tuples are containers for multiple values, commonly used when the stored data should not change.
- 76A Python dictionary stores data in_____value pairs.
Hint
Each identifying label is associated with corresponding data.
Answer
key
Explanation
A dictionary organizes information as key-value pairs.
- 77The keys in a dictionary must be_____so that each entry can be identified distinctly.
Hint
Duplicate keys are identified as a problem in the example.
Answer
unique
Explanation
Dictionary keys should be unique; the example warns that duplicate keys are not allowed.
- 78A dictionary literal is enclosed in curly_____.
Hint
These delimiters surround its key-value entries.
Answer
brackets
Explanation
Python uses curly brackets to create a dictionary literal.
- 79The dictionary method that retrieves a value by key and can provide a fallback is_____.
Hint
It can return a default when the requested key is missing.
Answer
get
Explanation
The get method retrieves a key's value and can return a specified default if that key is absent.
- 80A function is a reusable collection of code that performs a specific_____.
Hint
It groups instructions that work together to accomplish something.
Answer
task
Explanation
Functions organize code into reusable units, each designed to perform a particular task.
- 81The keyword used to define a function in Python is_____.
Hint
It appears before the function name in a definition.
Answer
def
Explanation
A Python function definition begins with the keyword def.
- 82A function's indented code does not run until the function is_____.
Hint
This means requesting that the function execute.
Answer
called
Explanation
Defining a function does not execute its body; the function runs when it is called.
- 83Information supplied to a function when it is called can be received through_____.
Hint
A name and age can be passed into a greeting function this way.
Answer
parameters
Explanation
Parameters let a function receive values and use them when performing its task.
- 84The keyword that sends a value back from a function is_____.
Hint
It can provide the result of a calculation to the caller.
Answer
return
Explanation
The return statement gives a value back to the code that called the function.
- 85After a function executes a return statement, it immediately exits that_____.
Hint
Code later in the same function body is not reached.
Answer
function
Explanation
A return statement ends the current function, so subsequent statements in its body do not run.
- 86The statement that lets a program execute code only when a condition is true is an_____statement.
Hint
It introduces a conditional branch.
Answer
if
Explanation
An if statement checks a condition and runs its indented block when that condition is true.
- 87The keyword that provides a fallback branch when an if condition is false is_____.
Hint
It corresponds to the idea of 'otherwise.'
Answer
else
Explanation
An else block runs when the preceding if condition is false and no earlier alternative condition matched.
- 88The Python keyword for checking another condition after an earlier if condition fails is_____.
Hint
It combines the ideas of 'else' and 'if.'
Answer
elif
Explanation
An elif branch allows a program to test another condition when the preceding if condition is false.
- 89The logical operator that makes a condition true when at least one of two conditions is true is_____.
Hint
It allows either condition to satisfy the branch.
Answer
or
Explanation
The or operator evaluates as true when either operand, or both operands, are true.
- 90The logical operator that requires both conditions to be true is_____.
Hint
It combines two requirements that must both hold.
Answer
and
Explanation
The and operator evaluates as true only when both conditions are true.
- 91The operator that reverses a Boolean condition is_____.
Hint
It turns true into false and false into true.
Answer
not
Explanation
The not operator negates the truth value of the expression that follows it.
- 92The comparison operator made from two equals signs checks whether two values are_____.
Hint
Do not confuse it with the single assignment symbol.
Answer
equal
Explanation
The double-equals comparison checks equality; a single equals sign assigns a value.
- 93The comparison operator made from an exclamation point followed by an equals sign checks whether values are_____.
Hint
It tests whether two values differ.
Answer
not equal
Explanation
This comparison returns true when the two values are different.
- 94A calculator program can use comparisons and if statements to select which arithmetic_____to perform.
Hint
The user's operator choice determines whether to add, subtract, multiply, or divide.
Answer
operation
Explanation
The calculator checks the selected operator and carries out the corresponding arithmetic operation.
- 95A while loop repeats its indented block as long as its condition remains_____.
Hint
The loop stops when its condition no longer holds.
Answer
true
Explanation
A while loop checks its condition and repeats the body while that condition is true.
- 96The condition controlling whether a while loop continues is also called its loop_____.
Hint
It protects the loop from continuing once its condition fails.
Answer
guard
Explanation
The course also calls a loop condition a loop guard; the loop repeats while that guard is true.
- 97In a guessing game, a while loop can continue prompting the user until the guess matches the_____word.
Hint
The program stores this target value before the guessing begins.
Answer
secret
Explanation
The guessing game repeats until the user's guess equals the stored secret word.
- 98To limit a guessing game, the program can track a guess count and compare it with a guess_____.
Hint
This value sets the maximum number of attempts.
Answer
limit
Explanation
The game can stop accepting guesses after the count reaches the specified limit.
- 99A for loop is designed to iterate over a collection or a range of_____.
Hint
Examples include letters in a string or values in a list.
Answer
items
Explanation
For loops process each item in a collection, or each value in a specified range.
- 100In a for loop over a string, the loop variable can represent one_____on each iteration.
Hint
The example processes the characters in a phrase one at a time.
Answer
letter
Explanation
When a for loop iterates over a string, its loop variable takes each character in turn.
- 101A range ending at a specified number does not include that ending_____.
Hint
A range from zero to ten includes zero through nine.
Answer
number
Explanation
The upper bound of a Python range is excluded from the sequence it produces.
- 102The built-in function that reports how many elements are in a list is_____.
Hint
It can be combined with range to iterate over list indexes.
Answer
len
Explanation
The len function returns the number of elements in a list.
- 103A loop placed inside another loop is a_____loop.
Hint
The inner loop runs within the body of the outer loop.
Answer
nested
Explanation
Nested loops are useful for processing structures such as rows and columns in a two-dimensional list.
- 104A list whose elements are themselves lists can represent a two-dimensional_____.
Hint
Rows and columns provide a useful way to visualize its elements.
Answer
grid
Explanation
A two-dimensional list can hold lists of values, forming a grid of rows and columns.
- 105A try block contains code that Python should attempt to_____.
Hint
An except block can handle a problem that happens while it runs.
Answer
execute
Explanation
The try part of a try-except structure contains code that may raise an error.
- 106A try-except structure prevents an unhandled error from automatically stopping the entire_____.
Hint
It lets the code respond to selected error situations.
Answer
program
Explanation
An except block can handle an error and allow the program to respond instead of simply terminating.
- 107Catching a specific exception is preferable to using a broad_____clause.
Hint
A catch-all can mistakenly handle unrelated problems.
Answer
exception
Explanation
The tutorial recommends catching specific error types because a broad except clause may hide unrelated errors.
- 108The exception raised when attempting to divide a number by zero is a zero division_____.
Hint
It names the invalid arithmetic operation.
Answer
error
Explanation
Python raises a ZeroDivisionError for a division-by-zero operation.
- 109When a user enters text where an integer is expected, converting it can raise a value_____.
Hint
The conversion fails because the input is not a valid integer.
Answer
error
Explanation
An invalid value supplied to int can raise a ValueError, which can be handled with an except block.
- 110The function used to open an external file is_____.
Hint
It takes a file name and a mode.
Answer
open
Explanation
The open function opens an external file so the program can read or write it.
- 111The file mode that allows a program to read a file without changing it is_____.
Hint
It is the mode used to retrieve the file's existing contents.
Answer
read
Explanation
Read mode gives access to a file's contents without writing changes to it.
- 112The file mode that adds new content to the end of an existing file is_____.
Hint
It preserves existing content and adds more after it.
Answer
append
Explanation
Append mode adds content to the end of the file rather than replacing its existing contents.
- 113Opening a file in write mode can_____its existing contents.
Hint
This mode is useful for writing a new file but can erase old content.
Answer
overwrite
Explanation
Write mode replaces the existing file contents, or creates a file if one does not exist.
- 114After finishing work with an opened file, good practice is to_____it.
Hint
This releases the file resource when it is no longer needed.
Answer
close
Explanation
The tutorial recommends closing a file after the program is done using it.
- 115The file method that reads the entire contents of a file is_____.
Hint
It returns the file's content as a whole.
Answer
read
Explanation
The read method retrieves all of the file's contents.
- 116The file method that reads a single line at a time is_____.
Hint
Repeated calls can advance to later lines.
Answer
readline
Explanation
The readline method reads one line from the file on each call.
- 117The file method that returns file lines as a list is_____.
Hint
Each line becomes an item that can be processed in a loop.
Answer
readlines
Explanation
The readlines method places the lines of a file into a list.
- 118The file method that writes supplied text to a file is_____.
Hint
Its effect depends on whether the file was opened in write or append mode.
Answer
write
Explanation
The write method adds the supplied text to a file, according to its opening mode.
- 119The escape sequence used to put appended text on a new line is backslash followed by_____.
Hint
It is the same line-break sequence used in strings.
Answer
n
Explanation
The backslash n escape sequence inserts a line break before appended text.
- 120A Python module is an external Python_____that can be imported into another file.
Hint
It can contain functions, variables, and other reusable code.
Answer
file
Explanation
A module is a Python file whose functionality can be imported into another Python file.
- 121The statement used to make another module's functionality available is_____.
Hint
It commonly appears at the beginning of a Python file.
Answer
import
Explanation
Importing a module lets a program use functions, variables, and other definitions from that module.
- 122A module that comes with Python rather than being installed separately is a_____module.
Hint
Its functionality is included with the language installation.
Answer
built-in
Explanation
Built-in modules are included with Python, unlike third-party modules that may need separate installation.
- 123A third-party module can commonly be installed from the command line with_____.
Hint
It is Python's package manager.
Answer
pip
Explanation
pip is commonly used to install third-party Python modules from the command line.
- 124The folder commonly used for installed third-party Python packages is called site_____.
Hint
The folder name describes where add-on packages are kept.
Answer
packages
Explanation
The tutorial identifies site packages as the folder where pip-installed third-party modules are commonly placed.
- 125A class can define a new data_____for representing an entity such as a student.
Hint
It extends the basic built-in categories such as strings and numbers.
Answer
type
Explanation
Classes let programmers create custom data types that can model real-world entities.
- 126A class describes a template, while an individual instance of that class is an_____.
Hint
A particular student with an actual name and GPA is one example.
Answer
object
Explanation
A class defines the structure, and an object is a specific instance with concrete attribute values.
- 127Data associated with an object, such as a student's name or GPA, is stored in its_____.
Hint
These describe the object's properties.
Answer
attributes
Explanation
Attributes hold information about an object, such as a student's name, major, GPA, or probation status.
- 128The special initialization method used to set up a newly created object is_____.
Hint
It is automatically involved when an object is created.
Answer
init
Explanation
The initialization method assigns the values supplied when an object is created to its attributes.
- 129In an instance method, the first parameter conventionally used to refer to the current object is_____.
Hint
It lets the method access that object's attributes.
Answer
self
Explanation
The self parameter refers to the current instance, such as when accessing its GPA.
- 130A function defined inside a class and used by its objects is a class_____.
Hint
It can provide a service such as checking whether a student meets a condition.
Answer
function
Explanation
A function defined in a class can operate on its objects or provide information about them.
- 131Inheritance lets one class reuse attributes and functions from another_____.
Hint
A specialized chef can reuse capabilities defined for a general chef.
Answer
class
Explanation
Inheritance allows a class to obtain functionality from a parent class without rewriting it.
- 132A class that inherits functionality from another class is often called a_____class.
Hint
It is the more specialized class in the relationship.
Answer
child
Explanation
A child class can inherit functionality from a parent class and add specialized behavior.
- 133A class whose functionality is inherited by another class is often called a_____class.
Hint
It is the more general class in the relationship.
Answer
parent
Explanation
A parent class provides attributes and methods that an inheriting child class can use.
- 134Defining a method in a child class with the same role as an inherited method lets it_____the parent's behavior.
Hint
A Chinese chef can provide a different special dish from a generic chef.
Answer
override
Explanation
A child class can override an inherited method to provide its own specialized behavior.
- 135A multiple-choice quiz can model each question using a class that stores its prompt and_____.
Hint
Both are needed to ask and grade a question.
Answer
answer
Explanation
The quiz example creates a question data type with a prompt attribute and an answer attribute.
- 136The Python interpreter provides an interactive environment for quickly testing Python_____.
Hint
It is useful for short experiments without creating a source file.
Answer
commands
Explanation
The interpreter executes entered Python commands immediately, making it useful for quick tests.
- 137The terminal or command prompt allows interaction with a computer by entering text_____.
Hint
It is an alternative to interacting through graphical buttons and windows.
Answer
commands
Explanation
A terminal or command prompt provides a text-based way to interact with the computer.
- 138The interpreter is suited to quick experiments, while a text editor is better for writing a complete Python_____.
Hint
A larger piece of code is easier to organize in a source file.
Answer
program
Explanation
The interpreter is convenient for small tests, but a text editor is more organized for building full programs.

Ask anything
We've read this whole study set, so questions about it get the best answers.