Lists
Tuples/LEGB
Dictionaries
Sets
Functions/Misc.
100
Refers to data that can be changed in place.
What is mutable?
100
A data type that cannot be changed after it has been created.
What is Immutable?
100
What is an unordered collection consisting of a key-value pair?
What is a dictionary?
100
True or False - to create an empty set in Python, we use {}? Note, if False, provide the correct syntax to create a set.
What is False? The correct way to create a set is set().
100
A variable passed to a function
What is an argument?
200
Adds a new item to a list?
What is .append()?
200
Keyword used to change or create global variables in a local namespace.
What is global?
200
True or False - by default, when Python examines a dictionary, it examines both the key and the value unless otherwise specified.
What is False - it examines the keys only.
200
Returns everything that the sets have.
What is union?
200
When this statement is reached, exits the function immediately.
What is return?
300
What splits a string into a list?
What is .split()?
300
If a variable has been declared inside a function, and there is also a global variable outside of that particular function, then that function will refer to the global variable.
What is False? It will refer to the local variable (the one inside the function).
300
True or False - keys and values must be unique.
What is False - only keys must be unique. Values can be duplicated.
300
Returns everything the set has, except for those that they have in common?
What is symmetric_difference()?
300
Describes the purpose of a function.
What is the docstring? Note it has triple quote strings and appears after the function header.
400
Adds a list to the end of another list
What is .extend()?
400
True or False - all list methods and functions that can change a list can also work on a Tuple.
What is False?
400
Error that occurs when you access a key in a dictionary that doesn't exist.
What is KeyError?
400
Given that a_set is a set object in Python filled with data, why would a_set[0] not work?
Python sets do not support indexing because they are unordered - there is no point to have that functionality.
400
The code that create a function is called the function_____?
What is the function definition?
500
True or False - if a mutable object like a list is passed to a function, and that function modifies that object, any changes to the object are not reflected in the main program since changing the object creates a new one.
What is False - it modifies it in place.
500
Acronym for the rules of scope used by Python, and what each acronym stands for.
What is LEGB (local - enclosing - global - built-ins)?
500
Function that returns a list of tuples of key-value pairs of the dictionary.
What is .items()
500
Set method to remove an element. Does not generate an error if the element doesn't exist in the set.
What is .discard()?
500
Provides a way of specifying what values a parameter should be even when the parameter isn't passed. Makes some arguments optional.
Default Values