Skip to content

Commit c0957e2

Browse files
committed
fix workspace.md
1 parent 8ea2de7 commit c0957e2

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ dask-worker-space
77
.ipynb_checkpoints/
88
.virtual_documents/
99

10+
lectures/sine_wave.py
1011
lectures/mathfoo.py
1112
lectures/mod.py
1213
lectures/test.py

lectures/workspace.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ jupytext:
33
text_representation:
44
extension: .md
55
format_name: myst
6+
format_version: 0.13
7+
jupytext_version: 1.17.2
68
kernelspec:
7-
display_name: Python 3
8-
language: python
99
name: python3
10+
display_name: Python 3 (ipykernel)
11+
language: python
1012
---
1113

1214
(workspace)=
@@ -51,7 +53,7 @@ Python files are used when writing long, reusable blocks of code - by convention
5153

5254
Let us begin by working with the following example.
5355

54-
```{code-block} python
56+
```{code-cell} ipython3
5557
:caption: sine_wave.py
5658
:lineno-start: 1
5759
@@ -68,17 +70,18 @@ plt.title('Sine Wave')
6870
plt.show()
6971
```
7072

71-
The code is first saved locally on the computer before it is executed.
72-
7373
As there are various ways to execute the code, we will explore them in the context of different development environments.
7474

7575
One major advantage of using Python scripts lies in the fact that you can "import" functionality from other scripts into your current script or Jupyter Notebook.
7676

77-
Let's rewrite the earlier code into a function.
77+
Let's rewrite the earlier code into a function and write to to a file called `sine_wave.py`.
7878

79-
```{code-block} python
79+
```{code-cell} ipython3
8080
:caption: sine_wave.py
8181
:lineno-start: 1
82+
83+
%%writefile sine_wave.py
84+
8285
import matplotlib.pyplot as plt
8386
import numpy as np
8487
@@ -94,7 +97,7 @@ def plot_wave(title : str = 'Sine Wave'):
9497
plt.show()
9598
```
9699

97-
```{code-block} python
100+
```{code-cell} ipython3
98101
:caption: second_script.py
99102
:lineno-start: 1
100103
@@ -345,9 +348,7 @@ In case you already haven't, try
345348

346349
For example, if you've installed the command line version, open up a terminal and enter.
347350

348-
```{code-block} bash
349-
:class: no-execute
350-
351+
```bash
351352
git clone https://github.com/QuantEcon/QuantEcon.py
352353
```
353354
(This is just `git clone` in front of the URL for the repository)

0 commit comments

Comments
 (0)