Text Editor
A code editor lets you save plain-text source files; saving them is separate from running them.
Understand the idea
A text editor changes the text stored in a file. A code editor adds features such as syntax highlighting, which colors recognizable parts of code. For source files, use an editor that saves plain text rather than a word processor’s formatted document. Styling in the editor is not itself part of the program.
To prepare the example, create a new plain-text file in your human-lab folder and save it as hello.py. Check the complete filename: some file managers hide extensions, so a file displayed as hello.py could actually have an extra .txt extension. The .py name tells you the intended source language; it does not install Python or execute the file.
Editing changes the text you see in the editor. Saving writes those changes to the file. Running the saved file is another action. If a program seems to ignore a change, confirm that you saved the correct file before investigating more complicated causes.
Key points
- 01 This Python example uses a plain-text source file, not a word-processing document.
- 02 Syntax highlighting helps you read code but does not change its meaning.
- 03 Saving a file and running a program are separate actions.
- 04 Use the intended filename and extension when saving.
- 05 An unsaved editor buffer can differ from the file a tool reads.
Worked example
Save the first source file
A worked example using sample data. Nothing here runs on your computer.
print("Hello, human!")A plain-text file named hello.py contains the line above.
No program output is produced just by saving it.The output box describes the result of saving, not the result of Python execution. Save in your own experiment folder; do not overwrite an unrelated file.
Visual
flowchart LR E["Edit text in editor"] -->|"Save"| F["hello.py on disk"] F --> N["Not executed yet"]
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.
- MDN: Code editors
Plain-text source editors versus formatted document editors, and syntax-highlighting features.
- MDN: Dealing with files
Filename/extension handling and making extensions visible while organizing project files.
Practice · predict the result
Diagnose an unsaved change
A small test from your robot instructors. Hints are welcome.
What you will practice: Distinguish an edited buffer, its saved source file, and the output produced by running that saved file.
Sample scenario. Synthetic plain-text editor with autosave and save hooks off. Each Run reads the saved hello.py from disk using an available Python 3 interpreter. Both versions contain only the displayed print call. This browser does not run Python or write files.
- Initially saved in hello.py
print("Hello, human!")- Unsaved editor buffer
print("Hello, robot!")- Step 1
Run the saved hello.py file with Python 3- Step 2
Save the editor buffer to hello.py- Step 3
Run the saved hello.py file with Python 3
The editor shows an unsaved change. Follow Run, Save, Run. Which greeting remains saved, and which two greeting lines appear in order?
Attempts stay on this browser and are kept separate from lesson views and your self-reported knowledge.
Sources and exercise scope
- MDN: Code editors
Plain-text code editing and saving; editor features are separate from the text of a program.
- Python 3.13: Using the Python Interpreter
Interpreter command discovery depends on the installation; a supplied filename identifies the script read by the interpreter.
- Python 3.13: An Informal Introduction to Python
print displays a string without its enclosing source quotation marks; interactive prompts are distinct from entered source.
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.