Python Dictionary Data type
Python has the dictionary data type to store the multiple values with indexes. While we are creating a dictionary variable, a Python dictionary object is created for storing the values with keys. Keys for dictionaries can use many different data types. A dictionary starts and ends with braces Brackets({}).
Unlike lists, items in dictionaries are unordered. Dictionaries can use integer values as index likely indexes in list. But it does not have to start at 0. It can be any number.
The Python tutorial on Techtuts provides an information about Python and Python 3 from the basis to high level. This tutorial provides a good understanding about the Python and Python for Technical, Non-Technical People, College Students and Working Professionals. Given examples are an easy to write and simple to practice by yourself.
Dictionary
Python has the dictionary data type to store the multiple values with indexes. A dictionary starts and ends with braces Brackets({}). Indexes for dictionaries are called as keys, and key with its associated value is called as key-value pair.
Dictionary datatype is changeable. it does not allow the duplicate values.
>>> var_dict1 = {1:'Python', 2:'Java'}
>>> print(var_dict1)
{1: 'Python', 2: 'Java'}
>>> var_dict2 = dict({1:'Python', 2:'Java'})
>>> print(var_dict2)
{1: 'Python', 2: 'Java'}
>>>
Dictionary datatype can store different type of data. we can use dict() function to create a dictionary datatype.
>>> var_dict3 = dict({'name':'Mike', 'age':26, 'empid': 1, 'is_active':True})
>>> print(var_dict3)
{'name': 'Mike', 'age': 26, 'empid': 1, 'is_active': True}
>>>
Dictionary datatype is changeable. So we can add, update and remove the values in python dictionary datatype.