Programming with Python

  1. Home
  2. Docs
  3. Programming with Python
  4. Dictionaries in python
  5. Properties of Dictionary

Properties of Dictionary

Properties of dictionary:-

  • Keys must be unique- Each key of the dictionary must be unique. Since keys are used to identify values in a dictionary, there cannot be duplicate keys in a dictionary.



As you can see with the above example, the value python is not get stored in the dictionary as it takes the value C++ as it comes first in the alphabetical order.

  • Dictionaries are mutable that is we can change the value of any key and add and delete the elements from the dictionary.
  • Sequence operations are not applied on dictionaries such as slicing, concatenation, etc.
  • The objects or values stored in a dictionary can basically be anything, but keys can only be immutable type-objects e.g., strings, tuples, integers, etc.

These are the properties of dictionary.

Was this article helpful to you? Yes No

How can we help?