DP Computer Science · Practical lab

Python playground

Write and run Python code. Use four spaces for each indentation level.

Pixel Forge · Planned two-lesson Python project

Your code stays on this browser.
main.pyPython code
OutputStarting editor…
Press Run Python to start.
Program input For code that uses input()

If you run out of answers, Python reports an EOFError. Add the missing lines and run again.

Python runs on your device. The first run downloads about 14 MB from this site. Programs stop automatically after 30 seconds; Stop keeps your code. Variables start fresh on each run.

What can I use?

Python’s core language and standard library: lists, dictionaries, functions, classes, math, random and text-file experiments. Files live in temporary browser memory and are cleared when Python restarts or you leave the page. Desktop windows, turtle graphics, pip installs and third-party packages are not included in this playground.

Code is saved locally on this browser when storage is available. Use Download .py to keep a copy for class. Loading an example replaces the editor after confirmation. Tab indents selected lines by four spaces. Shift + Tab removes one level. Enter follows Python block indentation. Pasted spaces are preserved. Press Escape then Tab to move keyboard focus out.

Powered by Pyodide and CodeMirror.