Skip to content

Commit 16e5113

Browse files
committed
Further fixes for loop callout
1 parent 56fd24e commit 16e5113

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

_episodes/02-loop.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,16 @@ command to signify the end of the loop body (e.g. end for); what is indented aft
156156

157157

158158
> ## What's in a name?
159-
> In the example above, the loop variable was given the name `char` as a mnemonic; it is short for 'character'. 'Char' is not a keyword in Python that pulls the characters from words or strings. In fact when a similar loop is run over a list rather than a word, the output would be each member of that list printed in order, rather than the characters.
160-
> ~~~
159+
>
160+
> In the example above, the loop variable was given the name `char`
161+
> as a mnemonic; it is short for 'character'.
162+
> 'Char' is not a keyword in Python that pulls the characters
163+
> from words or strings.
164+
> In fact when a similar loop is run over a list rather than a word,
165+
> the output would be each member of that list printed in order,
166+
> rather than the characters.
167+
>
168+
> ~~~
161169
> list = ['oxygen','nitrogen','argon']
162170
> for char in list:
163171
> print(char)
@@ -170,13 +178,18 @@ command to signify the end of the loop body (e.g. end for); what is indented aft
170178
> argon
171179
> ~~~
172180
> {: .output}
173-
> We can choose any name we want for variables. We might just as easily have chosen the name `banana` for the loop variable, as long as we use the same name when we invoke the variable inside the loop:
181+
>
182+
> We can choose any name we want for variables.
183+
> We might just as easily have chosen the name `banana`
184+
> for the loop variable,
185+
> as long as we use the same name when we invoke the variable inside the loop:
186+
>
174187
> ~~~
175188
> word = 'oxygen'
176189
> for banana in word:
177190
> print(banana)
178191
> ~~~
179-
> {.python}
192+
> {: .python}
180193
>
181194
> ~~~
182195
> o
@@ -187,7 +200,10 @@ command to signify the end of the loop body (e.g. end for); what is indented aft
187200
> n
188201
> ~~~
189202
> {: .output}
190-
> It is a good idea to choose variable names that are meaningful, otherwise it would be more difficult to understand what the loop is doing.
203+
>
204+
> It is a good idea to choose variable names
205+
> that are meaningful so that it is easier
206+
> to understand what the loop is doing.
191207
{: .callout}
192208
193209
Here's another loop that repeatedly updates a variable:

0 commit comments

Comments
 (0)