Playground

Pyodide Playground

Interactive Python environment running directly in your browser

Run Python in the Browser (Pyodide)

With Pyodide, you can run Python directly in the browser without any server-side setup. The runtime downloads on first use (~10MB) and all cells on the same page share variables by default.

  • Code is hidden by default — click "Show Code" to expand
  • Click "Run" to execute the cell
  • Click "Clear" to hide the output
  • All cells share the same Python environment on this page

Basic Examples

Start with simple Python expressions:

Py

Hello World

Idle
Py

Basic calculations

Idle

Variable Sharing Between Cells

Define data in one cell and reuse it in subsequent cells:

Py

Step 1: Define data

Idle
Py

Step 2: Statistical analysis

Idle
Py

Step 3: More operations

Idle

Data Visualization

Create beautiful plots with Matplotlib:

Py

Line plot

Idle
Py

Scatter plot with trend

Idle
Py

Bar chart

Idle

Working with Pandas

Analyze data using the popular Pandas library:

Py

DataFrame operations

Idle

Advanced: Machine Learning

Try a simple machine learning example:

Py

K-Means Clustering

Idle

Custom Layout Options

Use the HTML form to override locale or layout per cell:

Py

Horizontal Layout

Idle
Py

中文示例

未加载

Markdown Syntax

You can use the pyodide language identifier in code blocks to create interactive cells:

```pyodide
print("Hello")
```

```pyodide title="With Title"
print("Hello")
```

You can also use the <Pyodide> component for more control:

<Pyodide title="Custom Layout" layout="horizontal">
print("Hello")
</Pyodide>
  • First run: Downloads Pyodide runtime (~10MB); subsequent runs are instant
  • Variable persistence: Variables persist within this page; navigating away resets the environment
  • Package support: Most pure Python packages work; some C extensions are available
  • Performance: Runs in browser with near-native speed via WebAssembly
  • Large numerical computations may be slower than native Python
  • Some packages with C dependencies might not be available
  • File I/O is limited to browser's virtual filesystem
Copyright © 2026