CS home Practice & resources Python playground 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
ExampleStart here Big O · count the work Linear search Binary search Using input() Pixel Forge · student scaffold Two’s complement in one byte Boolean and bitwise operators Python practice · representation-1 · 1 Python practice · representation-1 · 2 Python practice · representation-2 · 1 Python practice · representation-2 · 2 Python practice · representation-3 · 1 Python practice · representation-3 · 2 Python practice · representation-4 · 1 Python practice · representation-4 · 2 Python practice · representation-5 · 1 Python practice · representation-5 · 2 Python practice · linear-search · 1 Python practice · linear-search · 2 Python practice · binary-search · 1 Python practice · binary-search · 2 Python practice · algorithm-efficiency · 1 Python practice · algorithm-efficiency · 2 Python practice · sorting-introduction · 1 Python practice · sorting-introduction · 2 Python practice · recursion · 1 Python practice · recursion · 2 Python practice · cs-w2-l1 · 1 Python practice · cs-w2-l1 · 2 Python practice · cs-w2-l2 · 1 Python practice · cs-w2-l2 · 2 Python practice · cs-w2-l3 · 1 Python practice · cs-w2-l3 · 2 Python practice · cs-w2-l4 · 1 Python practice · cs-w2-l4 · 2 Python practice · cs-w2-l5 · 1 Python practice · cs-w2-l5 · 2 Python practice · cs-w3-l1 · 1 Python practice · cs-w3-l1 · 2 Python practice · cs-w3-l2 · 1 Python practice · cs-w3-l2 · 2 Python practice · cs-w3-l3 · 1 Python practice · cs-w3-l3 · 2 Python practice · cs-w3-l4 · 1 Python practice · cs-w3-l4 · 2 Python practice · cs-w3-l5 · 1 Python practice · cs-w3-l5 · 2 Python practice · cs-w4-l1 · 1 Python practice · cs-w4-l1 · 2 Python practice · cs-w4-l2 · 1 Python practice · cs-w4-l2 · 2 Python practice · cs-w4-l3 · 1 Python practice · cs-w4-l3 · 2 Python practice · cs-w4-l4 · 1 Python practice · cs-w4-l4 · 2 Python practice · cs-w4-l5 · 1 Python practice · cs-w4-l5 · 2 Python practice · cs-w5-l1 · 1 Python practice · cs-w5-l1 · 2 Python practice · cs-w5-l2 · 1 Python practice · cs-w5-l2 · 2 Python practice · cs-w5-l3 · 1 Python practice · cs-w5-l3 · 2 Python practice · cs-w5-l4 · 1 Python practice · cs-w5-l4 · 2 Python practice · cs-w5-l5 · 1 Python practice · cs-w5-l5 · 2 Python practice · cs-w6-l1 · 1 Python practice · cs-w6-l1 · 2 Python practice · cs-w6-l2 · 1 Python practice · cs-w6-l2 · 2 Python practice · cs-w6-l3 · 1 Python practice · cs-w6-l3 · 2 Python practice · cs-w6-l4 · 1 Python practice · cs-w6-l4 · 2 Python practice · cs-w6-l5 · 1 Python practice · cs-w6-l5 · 2 Python practice · cs-w7-l1 · 1 Python practice · cs-w7-l1 · 2 Python practice · cs-w7-l2 · 1 Python practice · cs-w7-l2 · 2 Python practice · cs-w7-l3 · 1 Python practice · cs-w7-l3 · 2 Python practice · cs-w7-l4 · 1 Python practice · cs-w7-l4 · 2 Python practice · cs-w7-l5 · 1 Python practice · cs-w7-l5 · 2 Python practice · cs-w8-l1 · 1 Python practice · cs-w8-l1 · 2 Python practice · cs-w8-l2 · 1 Python practice · cs-w8-l2 · 2 Python practice · cs-w8-l5 · 1 Python practice · cs-w8-l5 · 2 Python practice · cs-w9-l1 · 1 Python practice · cs-w9-l1 · 2 Python practice · cs-w9-l2 · 1 Python practice · cs-w9-l2 · 2 Python practice · cs-w9-l3 · 1 Python practice · cs-w9-l3 · 2 Python practice · cs-w9-l4 · 1 Python practice · cs-w9-l4 · 2 Python practice · cs-w9-l5 · 1 Python practice · cs-w9-l5 · 2 Load example Your code stays on this browser.
Keyboard shortcuts Tab Indent 4 spaces Shift + Tab Outdent Shift + Enter Run code Esc then Tab Leave editor main.py Python code
Python code
▶ Run Python ■ Stop Download .py Restart Python
Output Starting editor…
Press Run Python to start. Program input For code that uses input() Enter one answer per line, in the order your program asks for them. 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 .
Enable JavaScript to run Python in this playground.