Lesson 4: Paths: every file has an address
Level 1, Meet Your Computer. Follow, build and type a file’s address. The new word: path. It follows lesson 3, Folders keep things tidy. Next comes lesson 5, Meet the terminal.
What the lesson explains
Paths: every file has an address. Your project folder is still here. How do we tell a computer exactly which file we mean?
A file’s address is its path. Each backslash \ means “go inside”. On the card: C:\Users\you\Documents\my-project
Start at the drive, then walk in. One folder at a time, all the way to the file. On the card: hello.py
What you do first
Follow the path to the cat. Open cat.png (a picture) at C:\Users\you\Documents\my-project\images\cat.png. Inside: "🐱".
The files on the practice computer
This lesson works in 5 folders. At the start, Documents\my-project holds images\, hello.py, notes.txt; Documents\my-project\images holds cat.png; Pictures holds beach.jpg; your home folder, C:\Users\you holds Desktop\, Documents\, Downloads\, Pictures\; Documents holds my-project\, song.mp3, story.txt.
You change nothing here, so lesson 5 finds the same files.
What you practise
Try it, "Follow the path to the cat": Open cat.png (a picture) at C:\Users\you\Documents\my-project\images\cat.png. Inside: "🐱".
Build a path, "Build the address": Build the path of notes.txt from tiles, part by part: C:\Users\you\Documents\my-project\notes.txt. Then: Build the path of beach.jpg from tiles, part by part: C:\Users\you\Pictures\beach.jpg.
Type a path, "Type the address of hello.py": Type the full path of hello.py: C:\Users\you\Documents\my-project\hello.py. Capitals and the slash direction do not matter; every letter does.
In your head, "Where does this path go?": What will open? The answer: "A song in Documents".
What PlayBuddy and PlayType say
PlayType: "Welcome to lesson four!"
PlayBuddy: "How does a friend find your house? With an address. Files have one too."
PlayType: "A file’s address is called a path. Each backslash means go inside."
PlayBuddy: "Start at the drive. Then walk in, one folder at a time."
PlayType: "Computers need exact spelling. Check every letter."
Help in every lesson
Everything happens on a pretend computer in your browser, so nothing touches your real files. PlayBuddy and PlayType stand beside the board, cheer you on and say when it is your turn.
A green ring shows where to click the first time. After that you do it on your own, and if you slip twice the ring comes back.
Stars
The lesson has 5 things to do. Up to one slip in ten gives three stars, up to one in four gives two, and finishing always gives at least one. Stars and progress are saved in this browser only; there is no account.
About DayOneCode
DayOneCode is an independent learning site, not affiliated with or endorsed by Anthropic. Claude and Claude Code are trademarks of Anthropic.