About the Python compiler
How to use the Python compiler
Write your code in the editor or open one of the templates: input and arithmetic, lists, a prime check, palindromes, a word count with a dictionary, a matrix, a class, recursion, exceptions and files. Press Run or Ctrl+Enter. What print writes appears in the output; anything written to sys.stderr, and the traceback of an error, appears in red.
The first run downloads Python (about 6 MB, once; your browser keeps it), so the Run button shows how far the download has come. After that, runs start at once.
How input works
Everything in the Input tab is the program's standard input. Each input() reads the next line, without its newline, and always returns text: wrap it in int() or float() for a number, and use input().split() for several values on one line. sys.stdin.readline(), sys.stdin.read() and for line in sys.stdin read from the same input, so contest-style fast input works too. When input() finds no line left it raises EOFError, and the compiler tells you to add input.
What runs your code
Python 3.14 runs inside your browser through Pyodide, a version of CPython built for the web, with the whole standard library: math, random, collections, itertools, functools, heapq, bisect, datetime, re, json, statistics and more. Packages cannot be installed with pip. Files you open for writing live in a folder of their own and are deleted when the run ends.
Each run may take 5 seconds; then it is stopped. Output is kept up to 10,000 lines or 1 MB, and the rest is cut with a notice. Programs cannot reach the network, and no packages or libraries can be installed: what a language brings with it is what you can use. Loops and functions check the clock, so a loop that never ends is stopped at 5 seconds with the output it printed so far. Stop ends a run at once; Python then restarts in the background, which takes a moment.
See it step by step
Visualize this run opens the code and input in the Python visualizer: every step shows the line that ran, the variables of each function call, and lists, dictionaries and objects drawn with arrows, so you can see when two names share one list. It follows the first 1,000 steps.
Questions
- Which Python version is it?
- Python 3.14, running in your browser through Pyodide.
- Can I install numpy or other packages?
- No. The compiler has Python's standard library only and no network, so pip cannot install anything.
- Why do I get ValueError: invalid literal for int()?
- int() was given text that is not a whole number: usually two numbers on one line (use input().split()) or a decimal number (use float()).
- Do files I create stay?
- No. A file exists only during the run that wrote it, so write and read it in the same program.
- Does my code go to a server?
- No. It runs in your browser, in a sandbox that cannot reach the network.
See also
- The Python code visualizer: run code one step at a time and see its memory.
- Python Programming: the course, with lessons and examples you can open here.
- Open-Source Contribution: the course, with lessons and examples you can open here.
- Discrete Mathematics: the course, with lessons and examples you can open here.
- Machine Learning: the course, with lessons and examples you can open here.
- Coding Interview Prep: the course, with lessons and examples you can open here.
- Computer Networks: the course, with lessons and examples you can open here.
- Digital Logic Design: the course, with lessons and examples you can open here.
- Computer Architecture: the course, with lessons and examples you can open here.
- Probability and Statistics: the course, with lessons and examples you can open here.
- Calculus and Linear Algebra: the course, with lessons and examples you can open here.
- Practice problems, checked against hidden tests.
- Online C compiler
- Online C++ compiler
- Online Java compiler
- Online SQL compiler
- Online JavaScript compiler
- Online 8086 Assembly compiler