@@ -15,7 +15,8 @@ keypoints:
1515- " Use `len(thing)` to determine the length of something that contains other values."
1616---
1717
18- In the first episode, we wrote Python code that plots values of interest from our first
18+ In the episode about visualizing data,
19+ we wrote Python code that plots values of interest from our first
1920inflammation dataset (` inflammation-01.csv ` ), which revealed some suspicious features in it.
2021
2122![ Line graphs showing average, maximum and minimum inflammation across all patients over a 40-day period.] ( ../fig/03-loop_2_0.png )
@@ -34,7 +35,7 @@ odds = [1, 3, 5, 7]
3435{: .language-python}
3536
3637In Python, a list is basically an ordered collection of elements, and every
37- element has a unique number associated with it -- its index. This means that
38+ element has a unique number associated with it --- its index. This means that
3839we can access elements in a list using their indices.
3940For example, we can get the first number in the list ` odds ` ,
4041by using ` odds[0] ` . One way to print each number is to use four ` print ` statements:
@@ -68,7 +69,7 @@ This is a bad approach for three reasons:
68693 . ** Fragile** . If we use it with a list that has more elements than what we initially
6970 envisioned, it will only display part of the list's elements. A shorter list, on
7071 the other hand, will cause an error because it will be trying to display elements of the
71- list that don't exist.
72+ list that do not exist.
7273
7374~~~
7475odds = [1, 3, 5]
@@ -116,7 +117,7 @@ for num in odds:
116117{: .output}
117118
118119This is shorter --- certainly shorter than something that prints every number in a
119- hundred-letter list --- and more robust as well:
120+ hundred-number list --- and more robust as well:
120121
121122~~~
122123odds = [1, 3, 5, 7, 9, 11]
@@ -145,7 +146,7 @@ for variable in collection:
145146~~~
146147{: .language-python}
147148
148- Using the example example above, the loop might look like this:
149+ Using the odds example above, the loop might look like this:
149150
150151![ Loop variable 'num' being assigned the value of each element in the list ` odds ` in turn and then being printed] ( ../fig/05-loops_image_num.png )
151152
@@ -215,15 +216,15 @@ The statement adds 1 to the old value of `length`,
215216producing 1,
216217and updates `length` to refer to that new value.
217218The next time around,
218- + `value` is `Darwin` and `length` is 1,
219+ `value` is `Darwin` and `length` is 1,
219220so `length` is updated to be 2.
220221After one more update,
221222`length` is 3;
222223since there is nothing left in `names` for Python to process,
223224the loop finishes
224225and the `print` function on line 5 tells us our final answer.
225226
226- Note that a loop variable is a variable that's being used to record progress in a loop.
227+ Note that a loop variable is a variable that is being used to record progress in a loop.
227228It still exists after the loop is over,
228229and we can re-use variables previously defined as loop variables as well:
229230
0 commit comments