diff --git a/_sources/chap08.ipynb b/_sources/chap08.ipynb index fc9a4a9..ef1a5d2 100644 --- a/_sources/chap08.ipynb +++ b/_sources/chap08.ipynb @@ -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." ] }, { @@ -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." ] }, @@ -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." ] }, { diff --git a/chap08.html b/chap08.html index f38e298..0f5e42d 100644 --- a/chap08.html +++ b/chap08.html @@ -1354,10 +1354,11 @@

8.12.3. Exercise“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.

-

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.

-

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.

-

Of the words in the word list, how many 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.

+

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.

+

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. +Of the words in the word list, how many 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.

You can use any of the functions from the previous chapter, like uses_any.

@@ -1369,7 +1370,7 @@

8.12.5. ExerciseThe Count of Monte Cristo 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”.

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.”

-

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. +

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. Use a single regular expression that matches all of these words and no others.

Think Python: 3rd Edition

Copyright 2024 Allen B. Downey