What is the purpose of the values() method for dictionaries?
Select an option to see the answer and solution.
What will be the output of the following code:
my_dict = {'a': 1, 'b': 2}
my_dict['c'] = 3
print(my_dict)
Select an option to see the answer and solution.
What is the output of the following code:
my_dict = {'a': 1, 'b': 2, 'c': 3}
my_dict.pop('b')
print(my_dict)
Select an option to see the answer and solution.
What is the output of the following code:
my_dict = {'a': 1, 'b': 2, 'c': 3}
print(my_dict.get('d', 0))
Select an option to see the answer and solution.
What is the output of the following code:
my_dict = {'a': 1, 'b': 2, 'c': 3}
my_dict.values()
print(my_dict)
Select an option to see the answer and solution.
What will be the output of the following code:
my_dict = {'a': 1, 'b': 2, 'c': 3}
my_dict.items()
print(my_dict)
Select an option to see the answer and solution.
What is the output of the following code:
my_dict = {'a': 1, 'b': 2}
del my_dict['b']
print(my_dict)
Select an option to see the answer and solution.
What is the output of the following code:
my_dict = {'a': 1, 'b': 2}
new_dict = my_dict.copy()
print(new_dict)
Select an option to see the answer and solution.
What will be the output of the following code:
keys = ['a', 'b', 'c']
values = 0
my_dict = dict.fromkeys(keys, values)
print(my_dict)
Select an option to see the answer and solution.
What is the output of the following code:
my_dict = {'a': 1, 'b': 2}
my_dict.popitem()
print(my_dict)
Select an option to see the answer and solution.
What will be the output of the following Python code?
>>> import collections
>>> a=collections.OrderedDict((str(x),x) for x in range(3))
>>> a
Select an option to see the answer and solution.
What will be the output of the following Python code?
>>> a={}
>>> a.fromkeys([1,2,3],"check")
Select an option to see the answer and solution.
What will be the output of the following Python code snippet?
d1 = {"john":40, "peter":45}
d2 = {"john":466, "peter":45}
d1 == d2
Select an option to see the answer and solution.
What will be the output of the following Python code snippet?
d = {"john":40, "peter":45}
print(list(d.keys()))
Select an option to see the answer and solution.
What will be the output of the following Python code snippet?
test = {1:'A', 2:'B', 3:'C'}
test = {}
print(len(test))
Select an option to see the answer and solution.
Which of the following statements create a dictionary?
Select an option to see the answer and solution.
What will be the output of the following Python code snippet?
a={1:"A",2:"B",3:"C"}
for i,j in a.items():
print(i,j,end=" ")
Select an option to see the answer and solution.
What will be the output of the following Python code snippet?
test = {1:'A', 2:'B', 3:'C'}
del test[1]
test[1] = 'D'
del test[2]
print(len(test))
Select an option to see the answer and solution.
What will be the output of the following Python code?
>>> a={1:"A",2:"B",3:"C"}
>>> a.items()
Select an option to see the answer and solution.
Which of the statements about dictionary values if false?
Select an option to see the answer and solution.