Which Python is running this page?
CPython, built for the browser. emscripten is the tool that compiled it to WebAssembly. On your computer the second line will be win32, darwin (macOS) or linux.
When you run a file, Python first compiles your source code into bytecode, a compact set of simple instructions, and then a virtual machine carries those instructions out one by one. The standard Python that does this is called CPython; knowing these steps explains Python's error behaviour and its speed.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 5 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Use compile() and co_consts to show what the compiler stores for the source "x = 60 * 60 * 24".
Write a program that prints Running on CPython if platform.python_implementation() is "CPython", and Running on something else otherwise.
A file has a SyntaxError on line 50 and a print("start") on line 1. What appears when you run it, and why?
Explain it without notes
What are the two steps Python performs when you run a file?
Why does a syntax error on the last line stop the first line from running, while a NameError on the last line does not?
What is CPython, and how does it relate to PyPy and Pyodide?
What is in __pycache__, and what happens if you delete it?
Give two reasons pure Python code runs slower than C, and two ways Python programs avoid the problem.
Expected output
Implementation: CPython
Platform: emscripten
Version: 3 13