@@ -143,6 +143,8 @@ All iterators can be placed to the right of the `in` keyword in `for` loop state
|
143 | 143 | In fact this is how the `for` loop works: If we write |
144 | 144 | |
145 | 145 | ```{code-block} python3 |
| 146 | +:class: no-execute |
| 147 | + |
146 | 148 | for x in iterator: |
147 | 149 | <code block> |
148 | 150 | ``` |
@@ -156,6 +158,8 @@ then the interpreter
|
156 | 158 | So now you know how this magical looking syntax works |
157 | 159 | |
158 | 160 | ```{code-block} python3 |
| 161 | +:class: no-execute |
| 162 | + |
159 | 163 | f = open('somefile.txt', 'r') |
160 | 164 | for line in f: |
161 | 165 | # do something |
@@ -527,6 +531,8 @@ We are now working in the module `__main__`, and hence the namespace for `__main
|
527 | 531 | Next, we import a module called `amodule` |
528 | 532 | |
529 | 533 | ```{code-block} python3 |
| 534 | +:class: no-execute |
| 535 | + |
530 | 536 | import amodule |
531 | 537 | ``` |
532 | 538 | |
@@ -1661,6 +1667,8 @@ Write a function to recursively compute the $t$-th Fibonacci number for any $t$.
|
1661 | 1667 | Complete the following code, and test it using [this csv file](https://raw.githubusercontent.com/QuantEcon/lecture-python-programming/master/source/_static/lecture_specific/python_advanced_features/test_table.csv), which we assume that you've put in your current working directory |
1662 | 1668 | |
1663 | 1669 | ```{code-block} python3 |
| 1670 | +:class: no-execute |
| 1671 | + |
1664 | 1672 | def column_iterator(target_file, column_number): |
1665 | 1673 | """A generator function for CSV files. |
1666 | 1674 | When called with a file name target_file (string) and column number |
@@ -1681,6 +1689,8 @@ for date in dates:
|
1681 | 1689 | Suppose we have a text file `numbers.txt` containing the following lines |
1682 | 1690 | |
1683 | 1691 | ```{code-block} none |
| 1692 | +:class: no-execute |
| 1693 | + |
1684 | 1694 | prices |
1685 | 1695 | 3 |
1686 | 1696 | 8 |
|