Python Dictionary

Python Dictionary

  • Dictionary is the completely different data structure of python which allows only pairs.

  • Dictionary store the key value pairs where key can never be duplicates and non hash-able type but values can be duplicates or hash-able or not.

  • A dictionary is a collection which is unordered, changeable and indexed.

  • A dictionary is network traveler.

  • Indexing and slicing not supported. but we take data out with the help of keys.

When to use dictionary

  • When you want to set your own storing paradigm.

Way to create a dictionary

  • dt = { }            #Blank Dictionary

  • dt = dict( )      #Blank Dictionary

 

 

Comments