In Python, Dictionaries stores data in key-value pairs. The key values are usually strings, and the value can be of any data type. The key-value pairs are enclosed with curly braces ({}). Each key-value pair is separated from the other using a colon (:).
To access any value in the dictionary, we just need to specify its key in a square brace ([ ]). Actually, dictionaries are used for fast retrieval of data.
Dictionary is a mutable data type, i.e., their values can be changed after creating it.
Program to demonstrate operations on a Dictionary
a={"name":"John","address":"USA","salary":75000} print(a["name"]) print(a["salary"])
Output:
John 75000
Leave a comment