You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: chap10.html
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1168,7 +1168,7 @@ <h3><span class="section-number">10.11.3. </span>Exercise<a class="headerlink" h
1168
1168
</section>
1169
1169
<sectionid="id2">
1170
1170
<h3><spanclass="section-number">10.11.4. </span>Exercise<aclass="headerlink" href="#id2" title="Link to this heading">#</a></h3>
1171
-
<p>Write function called <codeclass="docutils literal notranslate"><spanclass="pre">find_repeats</span></code> that takes a dictionary that maps from each key to a counter, like the result from <codeclass="docutils literal notranslate"><spanclass="pre">value_counts</span></code>.
1171
+
<p>Write a function called <codeclass="docutils literal notranslate"><spanclass="pre">find_repeats</span></code> that takes a dictionary that maps from each key to a counter, like the result from <codeclass="docutils literal notranslate"><spanclass="pre">value_counts</span></code>.
1172
1172
It should loop through the dictionary and return a list of keys that have counts greater than <codeclass="docutils literal notranslate"><spanclass="pre">1</span></code>.
1173
1173
You can use the following outline to get started.</p>
<p>Now we can use <codeclass="docutils literal notranslate"><spanclass="pre">sorted</span></code> with two keyword arguments:</p>
662
662
<ulclass="simple">
663
663
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">key=second_element</span></code> means the items will be sorted according to the frequencies of the words.</p></li>
664
-
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">reverse=True</span></code> means they items will be sorted in reverse order, with the most frequent words first.</p></li>
664
+
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">reverse=True</span></code> means the items will be sorted in reverse order, with the most frequent words first.</p></li>
<p>The we’ll store the words as keys in a dictionary so we can use the <codeclass="docutils literal notranslate"><spanclass="pre">in</span></code> operator to check quickly whether a word is valid.</p>
774
+
<p>Then we’ll store the words as keys in a dictionary so we can use the <codeclass="docutils literal notranslate"><spanclass="pre">in</span></code> operator to check quickly whether a word is valid.</p>
You can identify them because their names begin and end with two underscores.</p>
736
736
</section>
737
737
<sectionid="the-init-method">
738
-
<h2><spanclass="section-number">15.6. </span>The <strong>init</strong> method<aclass="headerlink" href="#the-init-method" title="Link to this heading">#</a></h2>
738
+
<h2><spanclass="section-number">15.6. </span>The init method<aclass="headerlink" href="#the-init-method" title="Link to this heading">#</a></h2>
739
739
<p>The most special of the special methods is <codeclass="docutils literal notranslate"><spanclass="pre">__init__</span></code>, so-called because it initializes the attributes of a new object.
740
740
An <codeclass="docutils literal notranslate"><spanclass="pre">__init__</span></code> method for the <codeclass="docutils literal notranslate"><spanclass="pre">Time</span></code> class might look like this:</p>
741
741
<divclass="cell docutils container">
@@ -1062,7 +1062,7 @@ <h3><span class="section-number">15.10.2. </span>Exercise<a class="headerlink" h
0 commit comments