Skip to content

Commit

Permalink
Merge pull request kushaldas#42 from iamsudip/coll
Browse files Browse the repository at this point in the history
	Fixed typo in collections chapter
  • Loading branch information
kushaldas committed Oct 15, 2013
2 parents 5333139 + 58992c0 commit 31890a9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/collections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Collections module
==================

In this chapter we will learn about a module called *Collections*. In this module we some nice data structures which will help you to solve various real life problems.
In this chapter we will learn about a module called *Collections*. This module implements some nice data structures which will help you to solve various real life problems.

::

Expand Down Expand Up @@ -34,15 +34,15 @@ Counter example
>>> Counter(words).most_common(10)
[('2', 97), ('the', 80), ('or', 78), ('1', 76), ('of', 61), ('to', 50), ('and', 47), ('python', 46), ('psf', 44), ('in', 38)]

Counter objects has an method called *elements* which returns an iterator over elements repeating each as many times as its count. Elements are returned in arbitrary order.
Counter objects has a method called *elements* which returns an iterator over elements repeating each as many times as its count. Elements are returned in arbitrary order.

::

>>> c = Counter(a=4, b=2, c=0, d=-2)
>>> list(c.elements())
['a', 'a', 'a', 'a', 'b', 'b']

*most_common* is a method which returns most common elements abd their counts from the most common to the least.
*most_common* is a method which returns most common elements and their counts from the most common to the least.

::

Expand Down

0 comments on commit 31890a9

Please sign in to comment.