Unit 02 · lesson
Prove What Environment You Are Actually Using
Core path: 30 minutes
A development environment can lie to you without technically lying.
You can have VS Code open on one folder while the terminal is sitting in another. You can have two Python installations on the same machine. You can type python and get a different interpreter than the one your editor selected. You can stare at the correct file and still execute a different copy somewhere else.
This is the hidden architecture under the interface.
The fix is not memorizing more buttons. The fix is learning how to ask the system what is actually true.
Start with location
Open the project from Lesson 4.
In the terminal, run:
pwd
ls
Then answer these without guessing:
- What directory is the shell currently using?
- Is
main.pyvisible from that location? - Is
experiments/visible? - If you type
python main.py, which file should Python open?
Now change directories:
cd experiments
pwd
ls
The editor may still show every file in the project tree. The shell does not care what the editor happens to display. Its working directory changed.
That distinction is one of those boring details people skip and then debug for twenty minutes.
Which Python did you launch?
Run:
python --version
Then ask Python to identify itself:
python -c "import sys; print(sys.executable)"
The first command tells you the Python version. The second tells you the executable path for the interpreter that actually launched.
On a Linux or macOS shell you can also inspect command resolution with:
which python
In PowerShell, use:
Get-Command python
You do not need to memorize every platform command today. The idea matters more:
pythonis a command name that the shell resolves to an actual executable somewhere on the system.
The interface may make Python feel like an abstract language floating in the editor. It is still software installed at a path.
Create a controlled mismatch
From the project root, create a second file named main.py inside experiments/:
print("EXPERIMENT COPY")
Now you have:
week02-project/
├── main.py
└── experiments/
└── main.py
Same filename. Two different files.
From the project root, run:
python main.py
Then:
python experiments/main.py
The command determines which file the interpreter receives.
Now move into experiments/:
cd experiments
python main.py
Same command text as before. Different working directory. Different file.
If that feels slightly dangerous, good. You are noticing why paths matter.
Read the system instead of the vibe
Imagine this situation:
- VS Code is displaying
week02-project/main.py. - Your terminal is inside
week02-project/experiments/. - You edit the root
main.py. - You type
python main.py. - The output does not change.
A beginner reaction is:
VS Code did not save my code.
Maybe.
But there is another explanation: the shell is executing experiments/main.py, not the file you edited.
Before changing anything, inspect:
pwd
ls
Then prove which file is being executed.
This is the developer habit I want from you: when the interface and the behavior disagree, inspect the layer underneath the interface.
Yes, that is a little Matrix. No, there is no green rain of code required.
Environment evidence check
Create a short notes/environment-check.md containing:
# Environment Check
## Shell location
Current working directory:
## Interpreter
Python version:
Python executable path:
## File resolution
Command:
File that command executed:
Evidence:
## One mismatch I created
What I changed:
What I expected:
What actually happened:
What command proved the cause:
Your explanation should distinguish these four things clearly:
- Editor — where you view and change files.
- Shell/terminal — where commands are entered and the working directory exists.
- Interpreter — the Python executable that processes your program.
- Source file — the specific file path handed to the interpreter.
If those four layers are clear in your head, Week 3 gets much easier because we can finally stop fighting the environment and start giving the program data.
Reader workbench
Separate source, saved file, and runtime
This is the Unit's one-file practice surface. Read the code, predict one result, run it, then change a value, input, condition, or boundary and explain why the evidence changed. Multi-file projects, Git, terminals, packages, and live services still belong in the full development workspace.
Run the code to see output.
Use the full development workspace when the lesson asks you to prove real paths, shell commands, or interpreter identity.