Understanding Language Models
A first run means writing a small program, saving it in a known folder, running it from that folder, and confirming that the output matches what you expected with no error text.
Why the First Run Comes First
Before you learn any concept in this course, you need one concrete experience: writing a small program, running it, and seeing it do what you asked on your own machine. Many learners find that abstract ideas make more sense once they have watched a program produce output for themselves. This lesson is that experience. It is deliberately short on theory. Its job is to show you how the course works, what you need in place, and what a healthy first run looks like, so that the lessons after it can focus on ideas rather than setup.
Treat this lesson as a checklist you can complete. By the end you should know where your code lives, whether anything needs installing, and how to confirm that your environment is working. The whole process rests on one loop that you will repeat throughout the course: write, save, run, read the output.
Predicting Where a Program Will Run
Before reading on, make a guess. Suppose you save a program in one folder, but the terminal is open in a different folder. Will the program run as expected?
What do you think happens?
You save a program in one folder but the terminal is open in another folder. Will it reliably run as expected?
Reveal answer
Not reliably. The course expects you to save the file in a known folder and run it from that same folder.
A wrong working folder is one of the most common reasons a first run fails, so location is the first thing to check. The next section explains why the location matters.
Where Code Lives and Where It Runs
In this course, the environment is your own computer unless a lesson tells you otherwise. You write the program in a plain text file or an editor, then save it. Saving it puts the file in a folder, and that folder is where the file lives. Running the program is a separate action: you type a command into the terminal, which is the text window where commands are typed and results are printed. The terminal always has a current folder, and the run happens from that folder.
Those three things are linked. The saved file sits inside a known folder. The terminal must be working in that same folder when you run the file. If the terminal is somewhere else, the command that refers to the file may not find it, and the run fails before your program does anything. The diagram below shows the relationship.
What Needs Installing Before the First Run
Some setups need software installed before anything will run, and some need nothing beyond a text editor and a terminal. Whether you need an installation depends on the environment the lesson asks you to use. The course setup instructions are the authoritative guide for your first run. Do not assume that a program you have seen elsewhere is the one this course uses, and remember that installation steps can change over time.
A simple way to tell that the setup is ready is to ask whether you can complete the loop from the course: write a file, save it in a known folder, run it from that folder, and read the output. If any step in that loop is missing a required tool, the setup is not ready yet.
Tracing a First Run from Writing to Output
A first run moves through a fixed sequence. Each stage depends on the one before it, so the sequence is worth following in order. The flowchart shows each stage and the decision at the end, where the output is checked.
- 1Write the program in a plain text file or an editor.
- 2Save the file in a folder you can find again.
- 3Open the terminal and make sure it is working in that same folder.
- 4Ask the computer to run the program.
- 5Read the output that appears in the terminal and compare it with what you expected.
Recognizing a Successful Run
A successful first run has a precise meaning. The program starts, executes every instruction without raising an error, and prints the output you expected. Nothing more is required. This means a successful run is not judged by how impressive the output looks. It is judged by three checks: the program started, no error occurred, and the output matches your expectation.
| Check | Successful first run | Failed first run |
|---|---|---|
| Program starts | Yes, the terminal begins the run | Often not, the run is refused or cannot find the file |
| Instructions | Every instruction executes | Execution stops at the point of trouble |
| Terminal text | Shows the output you expected | Shows error text instead of, or before, the output |
| Next action | Continue to the next lesson | Read the first line of the error, then check location and file name |
Comparing the signs of a successful first run with the signs of a failed one
The distinguishing feature is the absence of error text. Error messages are the environment reporting what it could not do. If you see them, the run did not succeed, even if some output also appeared. Use the comparison above to decide which case you are in.
Walking Through One Complete First Run
A first run from start to finish
You are asked to complete a first run in this course. Show how you would confirm each stage, and state whether the run counts as successful.
- 1Confirm the setup
Check the course setup instructions and make sure any named tool is installed and passes its version check. Do not install anything the instructions do not name.
- 2Write and save the program
Write the program in a plain text file or editor. Save it in one known folder, and note the exact file name you chose.
- 3Verify the location
Open the terminal and confirm that it is working in the folder where you saved the file. This is the first check, because a wrong working folder is a common cause of failure.
- 4Run the program
Ask the computer to run the file, using the same name you saved it under.
- 5Verify the output
Read the terminal. The run counts as successful only if the program started, no error text appeared, and the output matches what you expected.
If all five stages pass, you have completed a successful first run and the workflow the rest of the course depends on: a known location, a saved file, a run command, and a readable output. If any stage fails, return to the stage that failed rather than changing the program.
Mistakes That Stall a First Run
Common mistake Running the program from the wrong folder
What it looks likeThe file is saved in one folder, but the terminal is still working in a different folder.
Why it failsThe run starts from the terminal's current folder, so the command may not find the file.
Do this insteadConfirm that the terminal is working in the folder where you saved the file, then run again.
Common mistake Mismatched file name
What it looks likeThe file was saved under one name, but the run command refers to a different name.
Why it failsThe environment looks for the exact name it was given, so a mismatch prevents the program from being found.
Do this insteadCompare the saved name with the name in the run command, character for character.
Common mistake Installing software the course does not name
What it looks likeA learner installs a tool seen in another tutorial, which this course does not use.
Why it failsThe course setup instructions are the authoritative guide, and installation steps can change over time.
Do this insteadInstall only what the course setup instructions name, and check it against them.
Common mistake Treating a passing version check as finished setup
What it looks likeA learner sees a version number printed and assumes the environment is ready.
Why it failsA version check confirms one piece of setup. It does not prove the full loop works.
Do this insteadTreat the version check as the start, then complete a first run to confirm the environment.
Common mistake Changing several things at once after an error
Diagnosing a Failed Run
When a run fails, the terminal usually prints an error message. Read the first line first, since it usually names the problem. Then check the two causes that account for most failures: the location and the file name. Change one thing at a time and run again, so you always know which change made the difference. The flowchart follows that order.
What do you think happens?
When a run fails, which check should you make before questioning what the program does?
Reveal answer
Check the location and the file name first.
Most first-run problems come from the wrong working folder or a mismatched file name, so those checks come before anything else.
Practice Your Own First Run
Complete a first run in your course environment and record what you checked. Write down the folder where you saved your file, the exact file name, and the folder your terminal was working in when you ran it. Then state whether the run was successful, citing the three checks: the program started, no error text appeared, and the output matched what you expected. If it failed, name the first check you made.
Hints
- Compare the terminal's current folder with the folder where you saved the file before doing anything else.
- Look for error text in the terminal. Its first line usually names the problem.
- Change only one thing between runs so you know which change helped.
Key Takeaways
- Your code is saved in a known folder, and the run happens from the terminal's current folder, so the two locations must match.
- Install only what the course setup instructions name, and treat a successful version check as the start of setup rather than the end.
- A successful first run means the program starts, executes every instruction without an error, and prints the output you expected.
- When a run fails, read the first line of the error, then check the location and the file name, changing one thing at a time before running again.