Codectionary / Developer documentation / Python

Start with a beginner-focused editor that makes variables and program execution easier to inspect.

Choose the right installer

Instructions checked 18 October 2026 against the official documentation linked below. Menu labels may differ between releases; verify the selected interpreter rather than relying only on its display name.

The official Thonny page currently offers Thonny 5.0 installers with Python 3.14 for Windows and macOS. Those bundles do not require a separate Python installation. Choose the correct processor architecture, such as Intel/AMD versus Arm or Apple Silicon.

Download from thonny.org and follow its installation instructions. On Linux, the official setup uses an existing python3; distribution packages such as Ubuntu’s thonny or Fedora’s thonny may provide an older Thonny release. Follow the distribution’s package instructions rather than assuming the desktop bundles apply to Linux.

Choose local Python

Open Thonny and inspect its interpreter selection in the status area or Tools → Options → Interpreter (menu placement can differ on macOS). Choose local Python for these lessons, not a MicroPython device backend.

For a bundled install, start with the bundled interpreter. To use another Python or a virtual environment, select its executable. Run the diagnostic below to check what is actually executing.

Python — Thonny Shell or file

import sys
print(sys.version)
print(sys.executable)

Write and run hello.py

  1. Choose a new file in Thonny and enter the first-program example below in the editor, not the Shell.
  2. Save it as hello.py in python-practice.
  3. Choose Run → Run current script (F5). Read Hello, Python! in the Shell.
  4. Change the message and rerun. For a next step, add a variable and open View → Variables to see its value; the step debugger can show execution one step at a time.

Common problems

If Thonny tries to connect to a device, select the local Python interpreter. For imports, Tools → Manage packages targets the selected interpreter; check it before installing.

If a terminal import works but Thonny fails, compare sys.executable in both. Bundled Python and system Python have separate packages.

If F5 is intercepted by your keyboard, use the Run menu. Stop a stuck program before trying again. Keep code in the editor and terminal/package commands in the system shell, not at the Python >>> prompt.

Syntax

print("Hello, Python!")

Examples

Your first Python program

Save as hello.py in your project folder. Expected output: Hello, Python!

print("Hello, Python!")
  1. print is a built-in function that writes to the output stream.
  2. The quoted text is a string. The quotes are not printed.
  3. Parentheses pass that string to print. No extra package is required.

Best practices

  • Save your work before running it, and check the output after each small change.
  • Keep your learning project in its own folder. Do not name files after standard modules such as random.py or json.py.

Runtime & versions

Python interpreter. Feature availability depends on the language and runtime version used by your project; consult the official reference below.

Python language reference

Specifications & further reading