how to create a dictionary in python with numbers code example
Example 1: python make a dictionary
#title : Dictionary Example
#author : Joyiscold
#date : 2020-02-01
#====================================================
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
#Assigning a value
thisdict["year"] = 2018
Example 2: dictionary in python
#A dictionary has key-value pairs. Here 1,2,3 are the keys and Item1,Item2,Item3
#are their values respectively.
dictionaryName = { 1: "Item1", 2: "Item2", 3: "Item3"}
#retrieving value of a particular key
dictionaryName[1]
#retrieving all the keys in a dictionary
dictionaryName.keys()
#retrieving all the values in a dictionary
dictionaryName.values()