© Copyright | Created by the Girl with a ribbon ξ(🎀˶❛◡❛) | Built with <pyscript> JavaScript plugin
List of pyscript tags - Simple Printouts| Code Snippet | Final Output |
|---|---|
<py-script>print('Hello, World!')</py-script>
|
|
<py-script>
def wallis(n):
pi = 2
for i in range(1,n):
pi *= 4 * i ** 2 / (4 * i ** 2 - 1)
return pi
pi = wallis(100000)
pyscript.write('pi', f'π is approximately {pi:.3f}')
</py-script>
|
|
<py-script>
import datetime as dt
pyscript.write('today', dt.date.today().strftime('%A %B %d, %Y'))
</py-script>
|
Today is |
List of pyscript tags - Numpy and matplotlib| Code Snippet | Final Output |
|---|---|
<py-env>
- numpy
- matplotlib
</py-env>
<h1>Let's plot random numbers</h1>
<div id="plot"></div>
<py-script output="plot">
import matplotlib.pyplot as plt
import numpy as np
x = np.random.randn(1000)
y = np.random.randn(1000)
fig, ax = plt.subplots()
ax.scatter(x, y)
fig
</py-script>
|
Let's plot random numbers |
List of pyscript tags| Code Snippet | Final Output |
|---|---|
<py-env>
- numpy
- matplotlib
</py-env>
<h1>Let's plot random numbers</h1>
<div id="plot"></div>
<py-script output="plot">
import matplotlib.pyplot as plt
import numpy as np
x = np.random.randn(1000)
y = np.random.randn(1000)
fig, ax = plt.subplots()
ax.scatter(x, y)
fig
</py-script>
|
Let's plot random numbers |