Python Data Structure

Think of data structure as a way of storing and organizing data such that we can easily modify and get access efficiently. Any data structure is designed to suit a specific purpose so that it can be worked on with in appropriate ways. A good combination of algorithm and data structure allows to manipulate data efficiently. In Python, a common and well-known data structure is the list or also can be called as array, which contains a sequential collection of data items that can be accessed by an index. There are four data structures in Python – set, dictionary, list and tuple.

Python Set
A collection type which can store members of different data types but doesn’t index them in any particular order.
Properties of Python Set is that elements don’t have specific order,hence,will exist in a random order. Each member is unique in a set, and therefore can’t have duplicates. The members are immutable (can’t change their content) and hence, can’t accept changes once added in a set. The set itself is mutable (can change their content without changing their identity) and allows addition or discard of members.

Python Dictionaries
A data type similar to list, but works with keys and values instead of indexes. Dictionaries are also known as ‘mappings’, because they associate key objects to value objects. Dictionaries are indexed by keys and keys are unique while values may not be. The values of a dictionary can be of any data type, but the keys must be immutable data type such as strings,numbers,floats, or tuples.