Programming Languages

Python Playground

Run Python 3 entirely in your browser - print, loops, classes, numpy.

Runtime: Pyodide (WebAssembly)

About this playground

Write and execute Python 3 code on this page. The interpreter is Pyodide, a port of CPython compiled to WebAssembly - so you get real Python (not a JS approximation). Your code runs inside the page; nothing is uploaded. Pre-installed batteries include print, file-like StringIO, math, json, re and (on demand) numpy / pandas / matplotlib.

FAQs

Which Python version is this?

Pyodide 0.27 ships CPython 3.12. Most of the standard library works out of the box, including json, re, datetime, math, itertools, collections, and StringIO.

Can I use numpy / pandas?

Yes - they're available via Pyodide's package loader (await pyodide.loadPackage('numpy')). The first load downloads the wasm bundles, after which they stay cached for the session.

Does my code leave the browser?

No. Pyodide loads from a CDN once, then everything - parsing, execution, I/O - happens locally in WebAssembly. Your code is never sent to any server.

Why is the first run slow?

Pyodide is roughly 11 MB of compressed WASM. The first run downloads and initialises it (3-5 seconds on a fast connection). After that, runs are near-instant.

Can I read input() from the keyboard?

Not in this version - we capture stdout but the page can't pause for blocking stdin. Replace input() with a hard-coded value while experimenting.

Other playgrounds