LOCK.IN Expert: scripts that keep the books
You finish with a script that turns raw text into a report.
What is inside
All 6 chapters
1The shell as a tool
Say where you are, what is there, and what a path means.
2Pipes and filters
Turn a file into an answer with three small commands instead of one big one.
3Python values and functions
Compute something once, in a way the next person can read.
4Lists and dictionaries
Group raw lines into records and print a report from them.
5Reading input, line by line
Turn a messy text file into records, and say which lines were bad.
6Automate the whole job
Wrap the analysis in a script that is safe to run twice.
Quests and Challenges
- bank soalBuild a pipeline, stage by stage+10 XP
- quizCount and rank, without peeking+15 XP
- repoShip a script someone else can run+10 XP
Chapter 1: The shell as a tool
Read the first chapter
Where you are, and what is beside you
The shell always has a working directory. pwd prints it, ls lists what is in it, and cd moves. A path that starts with / is absolute: it means the same thing from anywhere. A path that starts with a name is relative to where you are standing.
pwdls -a /home/studentcd /home/studentpwdMost "file not found" errors are a path problem, not a missing file. Printing where you are costs one second and answers the question immediately.
Reading and writing a file
cat prints a file. echo prints its arguments. > sends that output into a file instead of the screen, and >> appends to what is already there. That single character is the difference between adding a line and destroying the file.
cd /home/studentecho "2026-10-24,buy,beginner" > sales.csvecho "2026-10-24,buy,expert" >> sales.csvcat sales.csvwc -l sales.csvecho hi > sales.csv replaces the whole file with one line, with no backup and no undo. >> is the one you usually want; reach for > when you mean "start this file over".
The other 5 chapters
Every interactive code checkpoint, the PDF edition, Quests and Socratic AI.
