RUN Program
Running a program asks a language tool or executable to perform its instructions; it is separate from editing the file.
Understand the idea
Suppose hello.py is saved in human-lab and contains print("Hello, human!"). From a shell working in that folder, a Python interpreter can read the file and evaluate that print() call. The command combines two things: the interpreter to start and the filename to give it.
The worked command assumes your installed Python 3 is available as python3. That name is common on macOS and Linux, but it is not universal and Python is not guaranteed to be installed. On Windows installations that provide the Python launcher, py -3 hello.py is an alternative for selecting Python 3. Use the command name supported by your installation; do not paste the shell prompt or a Python >>> prompt into the command.
If the shell cannot find the interpreter, address installation or command discovery first. If Python cannot open hello.py, check the working directory, complete filename, and saved location. If Python reports a syntax error, compare the source text with the example. These describe different failure stages; none is proof that you are bad at programming.
Running arbitrary downloaded code can have effects beyond printing a greeting. This example contains only a print() call, uses no credentials or network services, and does not modify your files. The lesson does not execute it automatically in your browser.
Key points
- 01 The command starts an interpreter and supplies the source filename.
- 02 hello.py must be saved where the supplied path identifies it.
- 03 The interpreter command name depends on the installation.
- 04 Command-not-found, missing-file, and syntax errors happen at different stages.
- 05 The one-line greeting produces text output, not a claim of broader programming mastery.
Worked example
Run the saved greeting
A worked example using sample data. Nothing here runs on your computer.
python3 hello.pyHello, human!Assumptions: Python 3 is installed as python3, the shell is in the folder containing hello.py, and hello.py contains only print("Hello, human!"). On Windows with the Python launcher installed, use py -3 hello.py instead. The output ends with a newline.
Visual
flowchart LR C["python3 hello.py"] --> I["Start installed interpreter"] I --> F["Read saved hello.py"] F --> O["Display greeting"]
Follow the primary sources
An original HWTL explanation, prepared and independently checked with AI against the sources below. This lesson has not yet been tested with human learners.
Source review completed 2026-10-07.
- Python 3.13: Using the Python Interpreter
Script execution from a filename, distinction from interactive mode, and installation-dependent interpreter names including the Windows launcher.
- Python 3.13: An Informal Introduction to Python
The Python print() call’s displayed string result and prompt conventions.
- POSIX.1-2024: pwd
The working-directory path needed to interpret a simple relative script filename.
- Python 3.13: Using Python on Windows — Python Launcher
The optional Windows launcher accepts -3 to select a core Python 3 installation; this is conditional on an installed launcher/interpreter, not a universal Windows command.
Practice · predict the result
Find the stage that needs attention
A small test from your robot instructors. Hints are welcome.
What you will practice: Explain how a command names both an available interpreter and a saved source file, then diagnose a mismatched script path.
Sample scenario. Synthetic POSIX-style environment. python3 is installed and discoverable. Only the listed saved script exists, and it is readable valid Python 3. There are no automatic directory changes, aliases, or network/file side effects. No command is actually executed.
- Available interpreter
python3 is installed and discoverable in this fixture- Current working directory
/human-lab- Saved file: /human-lab/notes/hello.py
print("Hello, human!")- Command to predict
python3 hello.py
The available interpreter is python3. Predict the command below: does it reach the saved greeting, fail to find the interpreter, or fail to find the requested script?
Attempts stay on this browser and are kept separate from lesson views and your self-reported knowledge.
Sources and exercise scope
- Python 3.13: Using the Python Interpreter
Interpreter command discovery depends on the installation; a supplied filename identifies the script read by the interpreter.
- POSIX.1-2024: pwd
Plain pwd reports the current working directory as an absolute path, followed by a newline.
Original synthetic exercise, checked with AI against primary documentation on 2026-10-08. Human learner validation is pending. A result here records this attempt; it does not establish mastery.
Make this lesson yours
Save it for later, or tell your robot what would help.
This correction stays on this browser. Browse all concepts if the topic is missing.
Familiarity is your own assessment. To use it in your coding tool, download your updated learning profile.
Choices are saved on this browser. They do not sync to your account or coding tool.
Lesson diagnostics
Download the public lesson material, resource choices, and robot text selected for this page. The file does not include your chat, code, or saved profile. Nothing from the trace is uploaded.
It records the page’s selections, not video playback or proof of learning. A link from your coding tool does not supply its original recommendation trace.
Enable JavaScript to create a trace on this device.