Posts

Showing posts with the label Dictionaries - Data Structures

Python3 Dictionaries DS

Python Data Structures : Dictionaries Dictionary          Python dictionary is an unordered collection of items. While other compound data types have only value as an element, a dictionary has a key : value pair. Dict Creation :   Eg:         #empty dictionary        my_dict={}         #dictionary with integers as keys        my_dict={1:'a',2:'b"}        print(my_dict)                 #dictionary with mixed keys        my_dict={'name':'satish',1:['abc','xy']}        print(my_dict)           #create empty dictionary using dict( )        my_dict=dict()        my_dict=dict([(1,'abc'),(2,'xy')])      #create a dict with list of tuples        print(my_dict) output:   {1:...