Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenDowney committed Oct 7, 2024
1 parent 198899e commit c0ccbe1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
10 changes: 5 additions & 5 deletions _sources/chap08.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7270,12 +7270,12 @@
"Each attempt has to be recognized as a word, not including proper nouns.\n",
"After each attempt, you get information about which of the letters you guessed appear in the target word, and which ones are in the correct position.\n",
"\n",
"For example, suppose the target word is `MOWER` and you guess `TRIED`. You would learn that `E` is in the word and in the correct position, `R` is in the word but not in the correct position, and `T`, `I`, and `D` are not in the word.\n",
"For example, suppose the target word is `MOWER` and you guess `TRIED`.\n",
"You would learn that `E` is in the word and in the correct position, `R` is in the word but not in the correct position, and `T`, `I`, and `D` are not in the word.\n",
"\n",
"As a different example, suppose you have guessed the words `SPADE` and `CLERK`, and you've learned that `E` is in the word, but not in either of those positions, and none of the other letters appear in the word.\n",
"\n",
"Of the words in the word list, how many could be the target word?\n",
"Write a function called `check_word` that takes a five-letter word and checks whether it could be the target word."
"Write a function called `check_word` that takes a five-letter word and checks whether it could be the target word, given these guesses."
]
},
{
Expand Down Expand Up @@ -7487,7 +7487,7 @@
"\n",
"In particular, he says it is \"shameless in its repetition of the same adjective,\" and mentions in particular the number of times \"its characters either shudder or turn pale.\"\n",
"\n",
"To see whether his objection is valid, let's count the number number of times the word `pale` appears in any form, including `pale`, `pales`, `paled`, and `paleness`, as well as the related word `pallor`. \n",
"To see whether his objection is valid, let's count the number number of lines that contain the word `pale` in any form, including `pale`, `pales`, `paled`, and `paleness`, as well as the related word `pallor`. \n",
"Use a single regular expression that matches all of these words and no others."
]
},
Expand Down Expand Up @@ -7827,7 +7827,7 @@
]
},
"source": [
"By my count, these words appear `223` times in a book that contains about `461,000` words. Mr. Eco might have a point."
"By my count, these words appear on `223` lines of the book, so Mr. Eco might have a point."
]
},
{
Expand Down
11 changes: 6 additions & 5 deletions chap08.html
Original file line number Diff line number Diff line change
Expand Up @@ -1354,10 +1354,11 @@ <h3><span class="section-number">8.12.3. </span>Exercise<a class="headerlink" hr
<p>“Wordle” is an online word game where the objective is to guess a five-letter word in six or fewer attempts.
Each attempt has to be recognized as a word, not including proper nouns.
After each attempt, you get information about which of the letters you guessed appear in the target word, and which ones are in the correct position.</p>
<p>For example, suppose the target word is <code class="docutils literal notranslate"><span class="pre">MOWER</span></code> and you guess <code class="docutils literal notranslate"><span class="pre">TRIED</span></code>. You would learn that <code class="docutils literal notranslate"><span class="pre">E</span></code> is in the word and in the correct position, <code class="docutils literal notranslate"><span class="pre">R</span></code> is in the word but not in the correct position, and <code class="docutils literal notranslate"><span class="pre">T</span></code>, <code class="docutils literal notranslate"><span class="pre">I</span></code>, and <code class="docutils literal notranslate"><span class="pre">D</span></code> are not in the word.</p>
<p>As a different example, suppose you have guessed the words <code class="docutils literal notranslate"><span class="pre">SPADE</span></code> and <code class="docutils literal notranslate"><span class="pre">CLERK</span></code>, and you’ve learned that <code class="docutils literal notranslate"><span class="pre">E</span></code> is in the word, but not in either of those positions, and none of the other letters appear in the word.</p>
<p>Of the words in the word list, how many could be the target word?
Write a function called <code class="docutils literal notranslate"><span class="pre">check_word</span></code> that takes a five-letter word and checks whether it could be the target word.</p>
<p>For example, suppose the target word is <code class="docutils literal notranslate"><span class="pre">MOWER</span></code> and you guess <code class="docutils literal notranslate"><span class="pre">TRIED</span></code>.
You would learn that <code class="docutils literal notranslate"><span class="pre">E</span></code> is in the word and in the correct position, <code class="docutils literal notranslate"><span class="pre">R</span></code> is in the word but not in the correct position, and <code class="docutils literal notranslate"><span class="pre">T</span></code>, <code class="docutils literal notranslate"><span class="pre">I</span></code>, and <code class="docutils literal notranslate"><span class="pre">D</span></code> are not in the word.</p>
<p>As a different example, suppose you have guessed the words <code class="docutils literal notranslate"><span class="pre">SPADE</span></code> and <code class="docutils literal notranslate"><span class="pre">CLERK</span></code>, and you’ve learned that <code class="docutils literal notranslate"><span class="pre">E</span></code> is in the word, but not in either of those positions, and none of the other letters appear in the word.
Of the words in the word list, how many could be the target word?
Write a function called <code class="docutils literal notranslate"><span class="pre">check_word</span></code> that takes a five-letter word and checks whether it could be the target word, given these guesses.</p>
<p>You can use any of the functions from the previous chapter, like <code class="docutils literal notranslate"><span class="pre">uses_any</span></code>.</p>
</section>
<section id="id2">
Expand All @@ -1369,7 +1370,7 @@ <h3><span class="section-number">8.12.5. </span>Exercise<a class="headerlink" hr
<p><em>The Count of Monte Cristo</em> is a novel by Alexandre Dumas that is considered a classic.
Nevertheless, in the introduction of an English translation of the book, the writer Umberto Eco confesses that he found the book to be “one of the most badly written novels of all time”.</p>
<p>In particular, he says it is “shameless in its repetition of the same adjective,” and mentions in particular the number of times “its characters either shudder or turn pale.”</p>
<p>To see whether his objection is valid, let’s count the number number of times the word <code class="docutils literal notranslate"><span class="pre">pale</span></code> appears in any form, including <code class="docutils literal notranslate"><span class="pre">pale</span></code>, <code class="docutils literal notranslate"><span class="pre">pales</span></code>, <code class="docutils literal notranslate"><span class="pre">paled</span></code>, and <code class="docutils literal notranslate"><span class="pre">paleness</span></code>, as well as the related word <code class="docutils literal notranslate"><span class="pre">pallor</span></code>.
<p>To see whether his objection is valid, let’s count the number number of lines that contain the word <code class="docutils literal notranslate"><span class="pre">pale</span></code> in any form, including <code class="docutils literal notranslate"><span class="pre">pale</span></code>, <code class="docutils literal notranslate"><span class="pre">pales</span></code>, <code class="docutils literal notranslate"><span class="pre">paled</span></code>, and <code class="docutils literal notranslate"><span class="pre">paleness</span></code>, as well as the related word <code class="docutils literal notranslate"><span class="pre">pallor</span></code>.
Use a single regular expression that matches all of these words and no others.</p>
<p><a class="reference external" href="https://allendowney.github.io/ThinkPython/index.html">Think Python: 3rd Edition</a></p>
<p>Copyright 2024 <a class="reference external" href="https://allendowney.com">Allen B. Downey</a></p>
Expand Down

0 comments on commit c0ccbe1

Please sign in to comment.