data after running the code below?data = {'a': 1, 'b': 2}
data['c'] = data['a'] + data['b']
data['a'] = 5The key 'c' is assigned the sum of values of 'a' and 'b' at that moment, which is 1 + 2 = 3. Then 'a' is updated to 5, but 'c' remains 3.
Dictionary keys must be immutable (unchangeable). Strings are immutable, but lists, dictionaries, and sets are mutable and cannot be keys.
Option B has invalid syntax (missing ':' after key 'x'). Option B uses the dict() constructor with a generator of (key, value) tuples, creating {1: 1, 2: 4, 3: 9}. Option B creates a set of tuples. Option B has invalid syntax.
my_dict = {'x': 10, 'y': 20}
value = my_dict['z']my_dict = {'x': 10, 'y': 20}
value = my_dict['z']Accessing a dictionary with a key that does not exist raises a KeyError.
data = {'a': 1, 'b': 2, 'c': 1, 'd': 3}, which code snippet correctly counts how many unique values are present?data = {'a': 1, 'b': 2, 'c': 1, 'd': 3}To count unique values, convert the dictionary's values to a set (which removes duplicates) and count its length.
