Skip to content

💻 Python Playground

Practice Python directly in your browser. No installation required. Errors are explained in plain English.

:zap: Powered by Pyodide — real Python running in your browser via WebAssembly
BERTA PLAYGROUND — Python 3.11
Loading Python...
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
Linear Regression Ch 7 Fitting a line from scratch
Sigmoid & Logistic Ch 7 Classification with probabilities
Gini Impurity Ch 7 Decision tree splitting
K-Means Clustering Ch 8 Grouping unlabeled data
PCA from Scratch Ch 8 Dimensionality reduction
Silhouette Score Ch 8 Cluster quality evaluation
Single Neuron Ch 9 Perceptron learning
Activation Functions Ch 9 Sigmoid, tanh, ReLU
Backpropagation Ch 9 Gradient computation
Simple Tokenization Ch 10 Splitting text into words
Bag of Words Ch 10 Word counts for documents
Cosine Similarity Ch 10 Comparing text vectors

Created by Luigi Pascal Rondanini | Generated by Berta AI