From 0c6892fbc9ca87721029c217960060d891e92189 Mon Sep 17 00:00:00 2001 From: Fabio Pliger Date: Mon, 23 May 2022 18:07:27 -0500 Subject: [PATCH] fix examples indent --- docs/tutorials/getting-started.md | 66 +++++++++++++++---------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/docs/tutorials/getting-started.md b/docs/tutorials/getting-started.md index 03289c67491..476ba943e7a 100644 --- a/docs/tutorials/getting-started.md +++ b/docs/tutorials/getting-started.md @@ -55,16 +55,16 @@ print back onto the page. For example, we can compute π. -print("Let's compute π:") -def compute_pi(n): - pi = 2 - for i in range(1,n): - pi *= 4 * i ** 2 / (4 * i ** 2 - 1) - return pi - -pi = compute_pi(100000) -s = f"π is approximately {pi:.3f}" -print(s) + print("Let's compute π:") + def compute_pi(n): + pi = 2 + for i in range(1,n): + pi *= 4 * i ** 2 / (4 * i ** 2 - 1) + return pi + + pi = compute_pi(100000) + s = f"π is approximately {pi:.3f}" + print(s) @@ -93,17 +93,17 @@ the `` tag to write to.
-import datetime as dt -pyscript.write('today', dt.date.today().strftime('%A %B %d, %Y')) + import datetime as dt + pyscript.write('today', dt.date.today().strftime('%A %B %d, %Y')) -def compute_pi(n): - pi = 2 - for i in range(1,n): - pi *= 4 * i ** 2 / (4 * i ** 2 - 1) - return pi + def compute_pi(n): + pi = 2 + for i in range(1,n): + pi *= 4 * i ** 2 / (4 * i ** 2 - 1) + return pi -pi = compute_pi(100000) -pyscript.write('pi', f'π is approximately {pi:.3f}') + pi = compute_pi(100000) + pyscript.write('pi', f'π is approximately {pi:.3f}') @@ -144,15 +144,15 @@ as a shortcut, which takes the expression on the last line of the script and run

Let's plot random numbers

-import matplotlib.pyplot as plt -import numpy as np + import matplotlib.pyplot as plt + import numpy as np -x = np.random.randn(1000) -y = np.random.randn(1000) + x = np.random.randn(1000) + y = np.random.randn(1000) -fig, ax = plt.subplots() -ax.scatter(x, y) -fig + fig, ax = plt.subplots() + ax.scatter(x, y) + fig @@ -187,7 +187,7 @@ In the HTML tag ``, paths to local modules are provided in the - numpy - matplotlib - paths: - - /data.py + - ./data.py @@ -195,14 +195,14 @@ In the HTML tag ``, paths to local modules are provided in the

Let's plot random numbers

-import matplotlib.pyplot as plt -from data import make_x_and_y + import matplotlib.pyplot as plt + from data import make_x_and_y -x, y = make_x_and_y(n=1000) + x, y = make_x_and_y(n=1000) -fig, ax = plt.subplots() -ax.scatter(x, y) -fig + fig, ax = plt.subplots() + ax.scatter(x, y) + fig