QuestionQ21

Data Serialization

Which two statements correctly describe the Python dictionary data type?

Choose two
  • A The data contained in a dictionary data type cannot be removed once the dictionary has been created.
  • B The data stored in a dictionary data type is sequenced and indexed.
  • C The data contained in a dictionary data type is a key/value pair.
  • D The data stored in a dictionary data type is not sequenced or indexed.
Explanation

A Python dict is a mutable mapping of unique keys to associated values, so its contents are key/value pairs and entries may be removed. It is not a sequence and does not use positional indexes; values are retrieved by their keys. Although current Python dictionaries preserve insertion order, they remain mappings rather than sequence types.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!