22. What will be the output of the following code:
my_dict = {'a': 1, 'b': 2}
my_dict['c'] = 3
print(my_dict)
my_dict = {'a': 1, 'b': 2}
my_dict['c'] = 3
print(my_dict)23. What is the output of the following code:
my_dict = {'a': 1, 'b': 2, 'c': 3}
my_dict.pop('b')
print(my_dict)
my_dict = {'a': 1, 'b': 2, 'c': 3}
my_dict.pop('b')
print(my_dict)24. What is the output of the following code:
my_dict = {'a': 1, 'b': 2, 'c': 3}
print(my_dict.get('d', 0))
my_dict = {'a': 1, 'b': 2, 'c': 3}
print(my_dict.get('d', 0))25. What is the output of the following code:
my_dict = {'a': 1, 'b': 2, 'c': 3}
my_dict.values()
print(my_dict)
my_dict = {'a': 1, 'b': 2, 'c': 3}
my_dict.values()
print(my_dict)26. What will be the output of the following code:
my_dict = {'a': 1, 'b': 2, 'c': 3}
my_dict.items()
print(my_dict)
my_dict = {'a': 1, 'b': 2, 'c': 3}
my_dict.items()
print(my_dict)27. What is the output of the following code:
my_dict = {'a': 1, 'b': 2}
del my_dict['b']
print(my_dict)
my_dict = {'a': 1, 'b': 2}
del my_dict['b']
print(my_dict)28. What is the output of the following code:
my_dict = {'a': 1, 'b': 2}
new_dict = my_dict.copy()
print(new_dict)
my_dict = {'a': 1, 'b': 2}
new_dict = my_dict.copy()
print(new_dict)29. What will be the output of the following code:
keys = ['a', 'b', 'c']
values = 0
my_dict = dict.fromkeys(keys, values)
print(my_dict)
keys = ['a', 'b', 'c']
values = 0
my_dict = dict.fromkeys(keys, values)
print(my_dict)30. What is the output of the following code:
my_dict = {'a': 1, 'b': 2}
my_dict.popitem()
print(my_dict)
my_dict = {'a': 1, 'b': 2}
my_dict.popitem()
print(my_dict)