Python Chapter 10
A list can be a dictionary key
false
You can use the ___ operator to determine whether a key exists in a dictionary
in
The ___ method returns all of a dictionary's kesy and their associated values as a sequence of tuples
items()
The ___ function returns the number of elements in a dictionary
len()
the following functoin returns the number of elements in a set
len()
This method removes an element and raises an exception if the element is not found.
remove
A tuple can be a dictionary key
true
The following statement creates an empty dictionary mydct = { }
true
sets store their elements in an unordered fashion
true
the following statement creates an empty set: myset = ()
true
the remove method raises an exception if the specified element is not found in the set
true
You can add a group of elements to a set with this method
update
you can use __ to create an empty dictionary
{}
this operator can be used to find the union of two sets
|
this operator can be used to find the intersection of two sets
&
Dictionaries are not sequences
True
The ___ dictionary method returns the value associated with a specified key. If the key is not found, it returns a default value
get()
the ___ method returns the value associated with a specified key, and removes that key value pair from the dictionary
pop()
the ___ method returns a randomly selected key-value pair from a dictionary
popitem()
this operator can be used to find the difference of two sets
-
The keys in a dictionary must be mutable objects.
False
this operator can be used to find the symmetric difference of two sets
^
You can add one element to a set with this method
add
You use ___ to delete an element from a dictionary
del
This set method removes an element but does not raise an exception if the element is not found
discard
the dictionary method popitem does not raise an exception if it is called on an empty dictionary
false
you can store duplicate items in a set
false