diff --git a/lectures/getting_started.md b/lectures/getting_started.md index c83d393b..a652fe52 100644 --- a/lectures/getting_started.md +++ b/lectures/getting_started.md @@ -365,6 +365,8 @@ You can install [QuantEcon.py](http://quantecon.org/quantecon-py) by starting Jupyter and typing ```{code-block} ipython3 +:class: no-execute + !conda install quantecon ``` @@ -373,6 +375,8 @@ into a cell. Alternatively, you can type the following into a terminal ```{code-block} bash +:class: no-execute + conda install quantecon ``` @@ -381,6 +385,8 @@ More instructions can be found on the [library page](http://quantecon.org/quante To upgrade to the latest version, which you should do regularly, use ```{code-block} bash +:class: no-execute + conda upgrade quantecon ``` @@ -389,6 +395,8 @@ Another library we will be using is [interpolation.py](https://github.com/EconFo This can be installed by typing in Jupyter ```{code-block} ipython3 +:class: no-execute + !conda install -c conda-forge interpolation ``` @@ -517,6 +525,8 @@ As the 1st task, try For example, if you've installed the command line version, open up a terminal and enter. ```{code-block} bash +:class: no-execute + git clone https://github.com/QuantEcon/QuantEcon.py ``` diff --git a/lectures/need_for_speed.md b/lectures/need_for_speed.md index 602762b8..837cbba3 100644 --- a/lectures/need_for_speed.md +++ b/lectures/need_for_speed.md @@ -198,6 +198,8 @@ Compiled languages avoid these overheads with explicit, static types. For example, consider the following C code, which sums the integers from 1 to 10 ```{code-block} c +:class: no-execute + #include int main(void) { diff --git a/lectures/python_advanced_features.md b/lectures/python_advanced_features.md index ab93552b..3472002f 100644 --- a/lectures/python_advanced_features.md +++ b/lectures/python_advanced_features.md @@ -143,6 +143,8 @@ All iterators can be placed to the right of the `in` keyword in `for` loop state In fact this is how the `for` loop works: If we write ```{code-block} python3 +:class: no-execute + for x in iterator: ``` @@ -156,6 +158,8 @@ then the interpreter So now you know how this magical looking syntax works ```{code-block} python3 +:class: no-execute + f = open('somefile.txt', 'r') for line in f: # do something @@ -527,6 +531,8 @@ We are now working in the module `__main__`, and hence the namespace for `__main Next, we import a module called `amodule` ```{code-block} python3 +:class: no-execute + import amodule ``` @@ -1661,6 +1667,8 @@ Write a function to recursively compute the $t$-th Fibonacci number for any $t$. 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 ```{code-block} python3 +:class: no-execute + def column_iterator(target_file, column_number): """A generator function for CSV files. When called with a file name target_file (string) and column number @@ -1681,6 +1689,8 @@ for date in dates: Suppose we have a text file `numbers.txt` containing the following lines ```{code-block} none +:class: no-execute + prices 3 8 diff --git a/lectures/python_by_example.md b/lectures/python_by_example.md index 44958ef5..9967a1c2 100644 --- a/lectures/python_by_example.md +++ b/lectures/python_by_example.md @@ -145,6 +145,8 @@ easily enough if you look around. On this machine, it's located in ```{code-block} ipython +:class: no-execute + anaconda3/lib/python3.7/site-packages/numpy ``` @@ -334,6 +336,8 @@ This example helps to clarify how the `for` loop works: When we execute a loop of the form ```{code-block} python3 +:class: no-execute + for variable_name in sequence: ``` diff --git a/lectures/python_essentials.md b/lectures/python_essentials.md index 954e59d8..10f8f409 100644 --- a/lectures/python_essentials.md +++ b/lectures/python_essentials.md @@ -315,6 +315,8 @@ Note that if `newfile.txt` is not in the present working directory then this cal In this case, you can shift the file to the pwd or specify the [full path](https://en.wikipedia.org/wiki/Path_%28computing%29) to the file ```{code-block} python3 +:class: no-execute + f = open('insert_full_path_to_file/newfile.txt', 'r') ``` @@ -621,6 +623,8 @@ f? ``` ```{code-block} ipython +:class: no-execute + Type: function String Form: File: /home/john/temp/temp.py @@ -633,6 +637,8 @@ f?? ``` ```{code-block} ipython +:class: no-execute + Type: function String Form: File: /home/john/temp/temp.py @@ -693,6 +699,8 @@ Here the function created by `lambda` is said to be *anonymous* because it was n In a {ref}`previous lecture `, you came across the statement ```{code-block} python3 +:class: no-execute + plt.plot(x, 'b-', label="white noise") ``` diff --git a/lectures/python_oop.md b/lectures/python_oop.md index 3c0a778c..6b813ac7 100644 --- a/lectures/python_oop.md +++ b/lectures/python_oop.md @@ -777,6 +777,8 @@ Implement $F_n$ as a class called `ECDF`, where Your code should work as follows (modulo randomness) ```{code-block} python3 +:class: no-execute + from random import uniform samples = [uniform(0, 1) for i in range(10)] @@ -785,6 +787,8 @@ F(0.5) # Evaluate ecdf at x = 0.5 ``` ```{code-block} python3 +:class: no-execute + F.observations = [uniform(0, 1) for i in range(1000)] F(0.5) ```