click below
click below
Normal Size Small Size show me how
SGD113Module3
Chapters 5 & 6
Question | Answer |
---|---|
The len() function does not work with ________. | lists |
You can assign an existing ________ a new value | list element |
It's possible to generate an error by invoking a list object's ______ method. | remove() |
(1, 2), (3, 4) is an example of a _________ | nested sequence. |
A dictionary key must be _______ | immutable |
A _______ cannot contain multiple items with the same key. | dictionary |
Unlike a tuple, a list is ____________________, meaning its elements can be changed. | mutable |
____________________ is a list method that adds a value to end of a list. | append |
____________________ is a list method that deletes the first occurrence of a value from the list | remove |
The ____________________ operator lets you test for the existence of a key in a dictionary. | in |
____________________ is a dictionary method that takes a key and retrieves its corresponding value from a dictionary. | get |
In a dictionary, an object used to look up another object | key |
A sequence inside another sequence. | nested sequence |
In a dictionary, an object that is returned when its corresponding key is looked up. | value |
A mutable collection of key-value pairs. | dictionary |
Automatically accessing each element of a sequence. | sequence unpacking |
A reference to an object, which has at least one other reference to it. | shared reference |
Quality that allows a list to be modified. | mutability |
A mutable sequence of any type. | list |
In a dictionary, a key-value pair. | item |
Quality that restricts a tuple from being modified. | immutability |
______ can do everything tuples can, plus more, because they can be modified | lists |
_______ are immutable, which makes them perfect for creating constants. | tuples |
It is a good idea to keep _________ to a minimum. experienced programmers rarely use sequences more than a level or two deep | nesting |
__________ are mutable. | lists |
When several variables refer to the same _______ value, they share the same reference. | mutable |
You can check for the existence of a key with the ______ operator | in |
You can check for the existence of a key by using the dictionary __________ method. | get |
A function ____________________ is code that defines what a new function does. | definition |
A(n) ____________________ is a string that documents a function. | docstring |
A function ____________________ is the first line of code that defines a function. | header |
Software ____________________ is leveraging existing software in a new project. | reuse |
A(n) ____________________ parameter value is a value that a parameter gets if no value is passed to it. | default |
A value returned by a function. | return value |
To hide a global variable inside a scope by creating a local variable of the same name. | shadow |
A mechanism that lets you think about the big picture without worrying about the details. | abstraction |
A name inside the parentheses of a function header that can receive a value. | parameter |
A variable that can be accessed in any part of a program. | global variable |
An argument passed to a specific parameter using the parameter name. | keyword argument |
An area of a program that's separate from other areas. | scope |
A value passed to a function parameter. | argument |
A variable that can be accessed only in the scope in which it was created. | local variable |
A technique of keeping independent code separate by hiding the details. | encapsulation |
_______________ increases company productivity, improves software quality. Provides consistency across software products and improves software performance. | software reuse |
__________ can make programs less confusing. | global constants |