Python Playground¶
Practice Python directly in your browser. No installation required. Errors are explained in plain English.
BERTA PLAYGROUND — Python 3.11
Initializing Python environment... (this takes a few seconds on first load)
Pyodide: loading...
How It Works¶
- Write code in the editor above (or load a pre-built exercise)
- Click Run to execute your Python code in the browser
- Errors are explained in plain English below the traceback
- No data leaves your browser — everything runs locally via WebAssembly
Supported Libraries
The playground runs standard Python 3.11. You have access to built-in modules like math, random, json, collections, itertools, and more. NumPy and other heavy libraries are not loaded to keep startup fast.
Keyboard Shortcut
Press Ctrl+Enter (or Cmd+Enter on Mac) to run your code.
Exercise Guide¶
| Exercise | Chapter | What You'll Practice |
|---|---|---|
| Hello World | Ch 1 | Print statements, f-strings |
| Variables & Types | Ch 1 | Type checking, conversion |
| Lists & Loops | Ch 1 | Iteration, comprehensions |
| Functions | Ch 1 | Defining and calling functions |
| Dictionaries | Ch 1 | Key-value operations |
| Binary Search | Ch 2 | Algorithm implementation |
| Stack | Ch 2 | LIFO data structure |
| Sorting | Ch 2 | Implementing merge sort |
| Vector Operations | Ch 3 | Math with lists |
| Dot Product | Ch 3 | Linear algebra basics |
| Coin Flip Simulation | Ch 4 | Probability and randomness |
| Bayes Theorem | Ch 4 | Conditional probability |
| Train/Test Split | Ch 6 | ML data preparation |
| Accuracy Score | Ch 6 | Model evaluation |
Created by Luigi Pascal Rondanini | Generated by Berta AI