DEV Community

Tommi k Vincent
Tommi k Vincent

Posted on

Dictionaries datatype in Python.

A dictionary is a collection of many values that are ordered,changeable and do not allow duplicates.

Enter the following into interactive shell to get a look of how a dictionary works:

>>> epl = {'chelsea':'south-London','Arsenal':'North-London','Liverpool':'maryside'}
Enter fullscreen mode Exit fullscreen mode

you can acces values through their keys:

>>> epl['chelsea']
'south-London'
>>>
Enter fullscreen mode Exit fullscreen mode

Inclusion dictionaries uses keys and associated with key-value pair to access the position of a certain key-value unlike indexes in lists , also in code dictionaries are type with curly braces.

Top comments (0)