Commit 196a0f7a authored by Raymond Hettinger's avatar Raymond Hettinger

Fix typos.

parent 7b4c2bed
...@@ -169,7 +169,7 @@ For example:: ...@@ -169,7 +169,7 @@ For example::
# Find the ten most common words in Hamlet # Find the ten most common words in Hamlet
>>> import re >>> import re
>>> words = re.findall('\w+', open('hamlet.txt').read().lower()) >>> words = re.findall('\w+', open('hamlet.txt').read().lower())
>>> Counter(hamlet_words).most_common(10) >>> Counter(words).most_common(10)
[('the', 1143), ('and', 966), ('to', 762), ('of', 669), ('i', 631), [('the', 1143), ('and', 966), ('to', 762), ('of', 669), ('i', 631),
('you', 554), ('a', 546), ('my', 514), ('hamlet', 471), ('in', 451)] ('you', 554), ('a', 546), ('my', 514), ('hamlet', 471), ('in', 451)]
...@@ -273,7 +273,7 @@ subtraction combine counters by adding or subtracting the counts of ...@@ -273,7 +273,7 @@ subtraction combine counters by adding or subtracting the counts of
corresponding elements. Intersection and union return the minimum and maximum corresponding elements. Intersection and union return the minimum and maximum
of corresponding counts:: of corresponding counts::
>>> c = Counter('a': 3, 'b': 1}) >>> c = Counter({'a': 3, 'b': 1})
>>> d = Counter({'a': 1, 'b': 2}) >>> d = Counter({'a': 1, 'b': 2})
>>> c + d # add two counters together: c[x] + d[x] >>> c + d # add two counters together: c[x] + d[x]
Counter({'a': 4, 'b': 3}) Counter({'a': 4, 'b': 3})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment