1. Error, copy() method doesn’t exist for dictionaries
2. {1: ‘A’, 2: ‘B’, 3: ‘C’}
3. {1: ‘A’, 2: ‘D’, 3: ‘C’}
4. “None” is printed
{1: ‘A’, 2: ‘B’, 3: ‘C’}
1. None
2. { None:None, None:None, None:None}
3. {1:None, 2:None, 3:None}
4. { }
{ }
1. More than one key isn’t allowed
2. Keys must be immutable
3. Keys must be integers
4. When duplicate keys encountered, the last assignment wins
Keys must be integers
1. {1: 5}
2. {1: 5, 2: 3}
3. Error, syntax error for pop() method
4. {1: 5, 3: 4}
{1: 5, 2: 3}
1. 9
2. 3
3. Too many arguments for pop() method
4. 4
9
1. 1 2 3
2. ‘A’ ‘B’ ‘C’
3. 1 ‘A’ 2 ‘B’ 3 ‘C’
4. Error, it should be: for i in a.items():
1 2 3
1. Syntax error
2. dict_items([(‘A’), (‘B’), (‘C’)])
3. dict_items([(1,2,3)])
4. dict_items([(1, ‘A’), (2, ‘B’), (3, ‘C’)])
dict_items([(1, ‘A’), (2, ‘B’), (3, ‘C’)])
1. More than one key can have the same value
2. The values of the dictionary can be accessed as dict[key]
3. Values of a dictionary must be unique
4. Values of a dictionary can be a mixture of letters and numbers
Values of a dictionary must be unique
1. method del doesn’t exist for the dictionary
2. del deletes the values in the dictionary
3. del deletes the entire dictionary
4. del deletes the keys in the dictionary
del deletes the entire dictionary
1. Removes an arbitrary element
2. Removes all the key-value pairs
3. Removes the key-value pair for the key given as an argument
4. Invalid method for dictionary
Removes an arbitrary element