Python · Playground

Python playground

Runs CPython 3.14 compiled to WebAssembly (Pyodide) inside a Web Worker on your device. The standard library is available; third-party packages are not. The first run downloads the runtime (about 13 MB), which your browser then keeps.

# Shop window notice
print("Rosewood Bakery")
print("Open from 7 to 3")
loaves = 48
print("Loaves baked today:", loaves)
print("Sourdough", "rye", "spelt", sep=" | ")

Output

Press Run to see the program’s output here.

Runs CPython 3.14 compiled to WebAssembly (Pyodide) inside a Web Worker on your device. The standard library is available; third-party packages are not. The first run downloads the runtime (about 13 MB), which your browser then keeps.

Python examples

Each one was run with CPython 3.11 before it was published. Load one, change it, run it.

  •  Python · Python Syntax and Your First Program: A program of print statements
    # Shop window notice
    print("Rosewood Bakery")
    print("Open from 7 to 3")
    loaves = 48
    print("Loaves baked today:", loaves)
    print("Sourdough", "rye", "spelt", sep=" | ")
  •  Python · Python Syntax and Your First Program: Indentation marks a block
    stock = 3
    if stock > 0:
        print("In stock")
        print("Units:", stock)
    print("Report finished")
  •  Python · Variables in Python: Assigning, reading and updating
    cars = 12
    print("Cars parked:", cars)
    cars = cars + 5
    print("After arrivals:", cars)
    cars -= 3
    print("After departures:", cars)
    spaces_free = 40 - cars
    print("Free spaces:", spaces_free)
  •  Python · Variables in Python: Several names at once, and swapping
    left, right = "jam", "honey"
    print(left, right)
    left, right = right, left
    print(left, right)
    width = height = 10
    height = 25
    print(width, height)
  •  Python · Variables in Python: A variable is a label, not a box
    order = ["tea", "scone"]
    same_order = order
    same_order.append("jam")
    print(order)
    print(order is same_order)
    total = 5
    other = total
    other = other + 1
    print(total, other)

How this page was checked. Every program on it was run with CPython 3.11 at build time; runs in your browser on CPython 3.14 (Pyodide) by the publishing checks, and the output shown is what it printed. The Run buttons execute the same code on your device; nothing you type is sent anywhere.