Here is a pre-populated REPL that outputs to the right hand side.
Press `Shift+Enter` or `Ctrl+Enter` to execute code in the REPL.
import random
names = ["Erik", "Eric", "Rohit", "Carol"]
random.choice(names)
Here is a pre-populated REPL that outputs to the right hand side.
Press `Shift+Enter` or `Ctrl+Enter` to execute code in the REPL.
| <!-- Taken from: https://pyscript.net/examples/hello_world.html --> | |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <meta name="viewport" content="width=device-width,initial-scale=1" /> | |
| <title>PyScript Hello World</title> | |
| <link rel="icon" type="image/png" href="favicon.png" /> | |
| <link rel="stylesheet" href="https://pyscript.net/unstable/pyscript.css" /> | |
| <script defer src="https://pyscript.net/unstable/pyscript.js"></script> | |
| </head> | |
| <body> | |
| Hello world! <br> | |
| Here is a polynomial curve. | |
| <py-env> | |
| - numpy | |
| - matplotlib | |
| </py-env> | |
| <py-script output="out"> | |
| # Replace this stuff here! | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| fig = plt.figure() | |
| x = np.linspace(-3, 3, 1000) | |
| y = x**2 | |
| plt.plot(x, y) | |
| fig | |
| </py-script> | |
| <div id="out"></div> | |
| </body> | |
| </html> | |
Hello world!
Here is a polynomial curve.
fig