Coders Packet

Collections Module in Python

By Abhishek Kumar

This module aims to improve the functionalities and provides alternatives to Python’s general-purpose built-in containers such as dict, list, set, and tuple

Requirements :

     -->   Python must be installed in your working system.

What collections offer us :

     -->   It improves and adds many features to the existing dataStructure.

     -->  Some of the useful data structures present in this module are:

               1.   namedtuple() :  The namedtuple() returns a tuple with names for each position in the tuple.

               2.   deque() :   Deque is a double-ended abstract data type object which supports appending and

                                      poping items in an efficient way. It is a double-ended queue.

               3.   Counter() : Counter is used to count the frequency of the element . How many times the element

                                        has occurred. It returns Dictionary.

               4.   OrderedDict() :   It is a type of dictionary that stores data in the same order we have inserted.

               5.   ChainMap() :   ChainMap is used to combine several dictionaries or mappings. It returns a

                                              list of dictionaries.

programming Language :

     -->  The language which we have used here in this program is PYTHON.

     -->  As we have used a  new Module Collections here so prior knowledge is a must.


Download Complete Code


No comments yet