most common python code example
Example 1: how to get the most common number in python
>>> from statistics import mode
>>> mode((1, 2, 4, 4, 5, 4, 4, 2, 3, 8, 4, 4, 4))
4
Example 2: python counter
>>> c = Counter(a=4, b=2, c=0, d=-2)
>>> d = Counter(a=1, b=2, c=3, d=4)
>>> c.subtract(d)
>>> c
Counter({'a': 3, 'b': 0, 'c': -3, 'd': -6})