Skip to content

Commit a70033d

Browse files
hosungsPythonCHB
authored andcommitted
Fixes some typos in Lesson 4 pages (UWPCE-PythonCert#172)
1 parent 9f76b71 commit a70033d

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"Andy Miles"
6767
"Rick Riehle",
6868
"Joseph Schilz",
69-
"Joseph Sheedy"
69+
"Joseph Sheedy",
7070
"Hosung Song"
7171
]
7272

source/exercises/kata_fourteen.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ Building the Trigrams dict
212212

213213
So you've got a list of words, and you need to build up a dict like one of the above.
214214

215-
It time to create a python file and start writting some code!
215+
It's time to create a python file and start writting some code!
216216

217217
.. code-block:: python
218218
@@ -244,7 +244,7 @@ So how do you actually build up that dict? That's kind of the point of the exerc
244244

245245
**Looping through the words**
246246

247-
Obviously you need to loop through all the words, so a ``for loop`` makes sense. However, this is a bit tricky. Usually in Python you loop through all the items in a list, and don't worry about the indices:
247+
Obviously you need to loop through all the words, so a ``for`` loop makes sense. However, this is a bit tricky. Usually in Python you loop through all the items in a list, and don't worry about the indices:
248248

249249
.. code-block:: python
250250
@@ -256,23 +256,23 @@ So contrary to the usual practice, an index can be helpful here:
256256

257257
.. code-block:: python
258258
259-
for i in len(words)-2: # why -2 ?
259+
for i in range(len(words)-2): # why -2 ?
260260
pair = words[i:i + 2]
261261
follower = words[i + 2]
262262
263263
**Adding a pair to the dict:**
264264

265265
For each pair in the text, you need to add it to the dict. But:
266266

267-
- words[i:i + 2] is a list with two words in it. Can that be used as a key in a dict? (Try it.) If not, how can you make a valid key out of it?
267+
- ``words[i:i + 2]`` is a list with two words in it. Can that be used as a key in a dict? (Try it.) If not, how can you make a valid key out of it?
268268

269269
- As you loop through the text, you will collect pairs of words. Each time, a given pair may already be in the dict.
270270

271271
- If the pair is not in the dict, you want to put it in the dict, with value being a list with the follower in it::
272272

273273
("may", "I"): ["wish"]
274274

275-
- If the pair already is in the dict, then you want to add the follower (the second word in the pair) to the list that's already there
275+
- If the pair already is in the dict, then you want to add the follower (the second word in the pair) to the list that's already there::
276276

277277
("wish", "I"): ["may", "might"]
278278

@@ -294,7 +294,7 @@ Using the Trigrams dict
294294

295295
This is the fun part. Once you have a mapping of word pairs to following words, you can build up some new "fake" text. Re-read the previous sections again to remind yourself of the procedure. Here are a couple of additional hints and questions to consider:
296296

297-
- The ```random`` module <https://docs.python.org/3/library/random.html#module-random>`_ is your friend here:
297+
- The ``random`` module <https://docs.python.org/3/library/random.html#module-random> is your friend here:
298298

299299
.. code-block:: python
300300
@@ -357,7 +357,7 @@ Do get the full trigrams code working first, then play with some of the fancier
357357
Code Structure
358358
--------------
359359

360-
Break your code down into a handful of separate functions. This way you can test each on its own, and it's easier to refactor one part without messing with the others. For instance, your __main__ block might look something like:
360+
Break your code down into a handful of separate functions. This way you can test each on its own, and it's easier to refactor one part without messing with the others. For instance, your ``__main__`` block might look something like:
361361

362362
.. code-block:: python
363363

source/exercises/mailroom-part2.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ In the first version of mailroom, you generated a letter to a donor who had just
5050

5151
In this version of your program, add a function (and a menu item to invoke it), that goes through all the donors in your donor data structure, generates a thank you letter for each donor, and writes each letter to disk as a text file.
5252

53-
Your main menu may look something like:
53+
Your main menu may look something like::
5454

5555
Choose an action:
5656

source/modules/DictsAndSets.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Calling the dict type object constructor:
5757
>>> dict(key1=3, key2= 5)
5858
{'key1': 3, 'key2': 5}
5959
60-
# creating and empty dict, and then populating it:
60+
# creating an empty dict, and then populating it:
6161
>>> d = {}
6262
>>> d['key1'] = 3
6363
>>> d['key2'] = 5
@@ -181,7 +181,7 @@ Traditionally, dictionaries have had no defined order. See this example from Pyt
181181
Note how I defined the dict in a natural order, but when it gets printed, or you display the keys, they are in a different order.
182182

183183
However, In cPython 3.6, the internal implementation was changed, and it *does* happen to preserve order. In cPython 3.6, that is considered an implementation detail -- and you should not count on it! However, as of cPython 3.7, dictionaries preserving order will be part of the language specification. This was declared by Guido on the python-dev mailing list on
184-
`Dec 15, 2017 <https://mail.python.org/pipermail/python-dev/2017-December/151283.html>`
184+
Dec 15, 2017 <https://mail.python.org/pipermail/python-dev/2017-December/151283.html>.
185185

186186
.. code-block:: ipython
187187

source/modules/Files.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Common Idioms
107107
do_something_with_line()
108108
109109
110-
We will learn more about the keyword with later, but for now, just understand
110+
We will learn more about the keyword ``with`` later, but for now, just understand
111111
the syntax and the advantage over the try-finally block:
112112

113113
.. code-block:: python
@@ -192,11 +192,11 @@ Absolute paths:
192192
'/home/chris/secret.txt'
193193
194194
195-
Either work with ``open()`` , etc.
195+
Either works with ``open()`` , etc.
196196

197197
(A working directory only makes sense with command-line programs.)
198198

199-
os module
199+
``os`` module
200200
----------
201201

202202
.. code-block:: python

0 commit comments

Comments
 (0)