Skip to content

Commit 56fd24e

Browse files
committed
Merge branch 'patch-1' of jarrah42/python-novice-inflammation into gh-pages
* 'patch-1' of https://github.com/jarrah42/python-novice-inflammation: Formatting in the "What's in a name?" callout is messed up
2 parents e79d702 + 1cb8d25 commit 56fd24e

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

_episodes/02-loop.md

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -157,32 +157,36 @@ command to signify the end of the loop body (e.g. end for); what is indented aft
157157

158158
> ## What's in a name?
159159
> 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-
>~~~ {.python}
161-
>list = ['oxygen','nitrogen','argon']
162-
>for char in list:
160+
> ~~~
161+
> list = ['oxygen','nitrogen','argon']
162+
> for char in list:
163163
> print(char)
164-
>~~~
164+
> ~~~
165+
> {: .python}
165166
>
166-
>~~~ {.output}
167-
>oxygen
168-
>nitrogen
169-
>argon
170-
>~~~
167+
> ~~~
168+
> oxygen
169+
> nitrogen
170+
> argon
171+
> ~~~
172+
> {: .output}
171173
> 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:
172-
>~~~ {.python}
173-
>word = 'oxygen'
174-
>for banana in word:
175-
> print(banana)
176-
>~~~
174+
> ~~~
175+
> word = 'oxygen'
176+
> for banana in word:
177+
> print(banana)
178+
> ~~~
179+
> {.python}
177180
>
178-
>~~~ {.output}
179-
>o
180-
>x
181-
>y
182-
>g
183-
>e
184-
>n
185-
>~~~
181+
> ~~~
182+
> o
183+
> x
184+
> y
185+
> g
186+
> e
187+
> n
188+
> ~~~
189+
> {: .output}
186190
> 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.
187191
{: .callout}
188192

0 commit comments

Comments
 (0)