Posts

Showing posts with the label DICTIONARY

DICTIONARY

  Dictionary Dictionaries are used to store data values in key:value pairs. A dictionary is a collection which is ordered*, changeable and does not allow duplicates. As of Python version 3.7, dictionaries are ordered . In Python 3.6 and earlier, dictionaries are unordered . Dictionaries are written with curly brackets, and have keys and values:   thisdict = {    "brand" : "Ford" ,    "model" : "Mustang" ,    "year" : 1964 } print (thisdict) Dictionary Items Dictionary items are ordered, changeable, and does not allow duplicates. Dictionary items are presented in key:value pairs, and can be referred to by using the key name. Print the "brand" value of the dictionary: thisdict = {    "brand" : "Ford" ,    "model" : "Mustang" ,    "year" : 1964 } print (thisdict[ "brand" ])     Ordered or Unordered? As of Python version 3.7, dict...