8000 fix examples indent (#454) · yannickfunk/pyscript@0639827 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0639827

Browse files
authored
fix examples indent (pyscript#454)
1 parent eaacd45 commit 0639827

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

docs/tutorials/getting-started.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@ print back onto the page. For example, we can compute π.
5555
</head>
5656
<body>
5757
<py-script>
58-
print("Let's compute π:")
59-
def compute_pi(n):
60-
pi = 2
61-
for i in range(1,n):
62-
pi *= 4 * i ** 2 / (4 * i ** 2 - 1)
63-
return pi
64-
65-
pi = compute_pi(100000)
66-
s = f"π is approximately {pi:.3f}"
67-
print(s)
58+
print("Let's compute π:")
59+
def compute_pi(n):
60+
pi = 2
61+
for i in range(1,n):
62+
pi *= 4 * i ** 2 / (4 * i ** 2 - 1)
63+
return pi
64+
65+
pi = compute_pi(100000)
66+
s = f"π is approximately {pi:.3f}"
67+
print(s)
6868
</py-script>
6969
</body>
7070
</html>
@@ -93,17 +93,17 @@ the `<py-script>` tag to write to.
9393
<br>
9494
<div id="pi" class="alert alert-primary"></div>
9595
<py-script>
96-
import datetime as dt
97-
pyscript.write('today', dt.date.today().strftime('%A %B %d, %Y'))
96+
import datetime as dt
97+
pyscript.write('today', dt.date.today().strftime('%A %B %d, %Y'))
9898

99-
def compute_pi(n):
100-
pi = 2
101-
for i in range(1,n):
102-
pi *= 4 * i ** 2 / (4 * i ** 2 - 1)
103-
return pi
99+
def compute_pi(n):
100+
pi = 2
101+
for i in range(1,n):
102+
pi *= 4 * i ** 2 / (4 * i ** 2 - 1)
103+
return pi
104104

105-
pi = compute_pi(100000)
106-
pyscript.write('pi', f'π is approximately {pi:.3f}')
105+
pi = compute_pi(100000)
106+
pyscript.write('pi', f'π is approximately {pi:.3f}')
107107
</py-script>
108108
</body>
109109
</html>
@@ -144,15 +144,15 @@ as a shortcut, which takes the expression on the last line of the script and run
144144
<h1>Let's plot random numbers</h1>
145145
<div id="plot"></div>
146146
<py-script output="plot">
147-
import matplotlib.pyplot as plt
148-
import numpy as np
147+
import matplotlib.pyplot as plt
148+
import numpy as np
149149

150-
x = np.random.randn(1000)
151-
y = np.random.randn(1000)
150+
x = np.random.randn(1000)
151+
y = np.random.randn(1000)
152152

153-
fig, ax = plt.subplots()
154-
ax.scatter(x, y)
155-
fig
153+
fig, ax = plt.subplots()
154+
ax.scatter(x, y)
155+
fig
156156
</py-script>
157157
</body>
158158
</html>
@@ -187,22 +187,22 @@ In the HTML tag `<py-env>`, paths to local modules are provided in the
187187
- numpy
188188
- matplotlib
189189
- paths:
190-
- /data.py
190+
- ./data.py
191191
</py-env>
192192
</head>
193193

194194
<body>
195195
<h1>Let's plot random numbers</h1>
196196
<div id="plot"></div>
197197
<py-script output="plot">
198-
import matplotlib.pyplot as plt
199-
from data import make_x_and_y
198+
import matplotlib.pyplot as plt
199+
from data import make_x_and_y
200200

201-
x, y = make_x_and_y(n=1000)
201+
x, y = make_x_and_y(n=1000)
202202

203-
fig, ax = plt.subplots()
204-
ax.scatter(x, y)
205-
fig
203+
fig, ax = plt.subplots()
204+
ax.scatter(x, y)
205+
fig
206206
</py-script>
207207
</body>
208208
</html>

0 commit comments

Comments
 (0)
0