Quiz Complete, well Done!
Value
|
|
|
|
|
|
|
|
|
|
Dictionary Methods
The method used to add a new key-value pair to a dictionary is
().
What does the method 'keys()' do in Python?
What is the syntax for creating a dictionary in Python?
If you try to access a key that does not exist in a dictionary, it will result in a(n)
.
What is the time complexity of accessing an element in a dictionary?
How do you add a new key-value pair to an existing dictionary?
What does the method 'values()' do in Python?
What is the output of the following code?
dict = {'a': 1, 'b': 2, 'c': 3}
print('a' in dict)
What is the output of the following code?
dict = {'a': 1, 'b': 2, 'c': 3}
print(dict.get('d', 'Not found'))
What is the output of the following code?
dict = {'a': 1, 'b': 2, 'c': 3}
print(dict['b'])
What happens if you try to access a key that does not exist in a dictionary?
The function used to check if a key is present in a dictionary is
().
A
is a collection of key-value pairs.
Which of the following is NOT a valid key type for a dictionary?
What is a dictionary in Python?
A key in a Python dictionary must be of a(n)
type.