How Python Runs in the Browser (Pyodide)
Traditional online Python editors (Replit, Trinket, some older tools) send your code to a server, run it there, and return the output. This means latency, rate limits, and privacy concerns. Pyodide takes a different approach: it compiles CPython ā the official Python interpreter ā to WebAssembly (WASM), a binary format that modern browsers can execute natively at near-native speed. When you click Run, your code executes inside your own browser tab. No network request is made, no data leaves your device. The ToolMint Python Code Editor uses Pyodide. The first run downloads the ~10MB WASM runtime, which is cached by your browser. All subsequent runs on the same page are instant.
What You Can Do (and What You Cannot)
Can do: ⢠Run any Python 3 code ⢠Use the full standard library: math, json, random, datetime, re, csv, collections, itertools, functools, string, os.path, and more ⢠Import third-party packages bundled with Pyodide: numpy, pandas, matplotlib, scipy, scikit-learn (these load on demand and require an internet connection) ⢠Use input() with the stdin simulator ā each line you provide feeds one input() call ⢠Run programs with loops, functions, classes, recursion, file-like operations Cannot do: ⢠Install arbitrary pip packages (only Pyodide-bundled packages are available) ⢠Access the local file system (use StringIO or io.BytesIO for file-like operations) ⢠Run indefinitely (long loops may freeze the browser tab) ⢠Use threading or multiprocessing in the standard sense ⢠Make network requests to servers that do not send CORS headers
When to Use Browser Python vs Installing Locally
Use browser-based Python when: ⢠You are a beginner who wants to start coding immediately without setup ⢠You are on a computer where you cannot install software (school computer, work restrictions) ⢠You want to quickly test a small piece of code without opening a terminal ⢠You are teaching and want students to follow along without any local setup ⢠You need to run code on a shared or temporary device Install Python locally when: ⢠You are building a project with multiple files and dependencies ⢠You need packages not available in Pyodide ⢠You work with files on your local system ⢠You need maximum execution speed for computation-heavy work ⢠You use frameworks like Flask, Django, FastAPI, or scripts that interact with your OS
How to Simulate input() in Browser Python
Programs that call input() are common in tutorials and exercises. In a terminal, input() reads from keyboard. In a browser, there is no keyboard input during execution. The solution: provide all input values in the Input panel before running. Each line in the Input panel feeds one input() call in order. Example code: name = input('Enter your name: ') age = int(input('Enter your age: ')) print(f'Hello {name}, you are {age} years old') Input panel values: Alice 25 Output: Hello Alice, you are 25 years old This matches how competitive programming judges work ā they provide all input upfront and your program processes it in order. Practicing with the stdin simulator prepares you for that exact format.