Everything you need before the bell rings
Learning Objectives
Students will be able to…
- ✓Read from a file.
- ✓Write to a file.
- ✓Make data persist.
- ✓Close files properly.
How does a program save data so it’s still there next time?
File Input/Output
Project each one and have students answer about file I/O.
50 minutes, five moves
Tap any phase to open the teacher moves and student actions.
Hook — Where Did It Go?
Your program saves a high score — but it’s gone when you restart. Why?
👩🏫 Teacher Moves
- Pose the question.
- Share ideas.
- Set the goal.
🎒 Student Actions
- Think.
- Share.
- Get ready.
Use — File I/O
Students learn.
👩🏫 Teacher Moves
- Send students to File Input/Output.
- Note files persist, variables do not.
- Note close files.
🎒 Student Actions
- Answer.
- Note it.
- Note it.
Modify — Read & Write
Students practice.
👩🏫 Teacher Moves
- Open a file for reading.
- Read its contents.
- Open one for writing.
🎒 Student Actions
- Open.
- Read.
- Write.
Create — Create
Students apply.
👩🏫 Teacher Moves
- Write data to a file.
- Read it back.
- Use a ‘with’ block.
🎒 Student Actions
- Write.
- Read.
- With.
Reflect — Reflect
Students close.
👩🏫 Teacher Moves
- What does file I/O do?
- How do you save data?
- Complete the exit ticket.
🎒 Student Actions
- Say it.
- Say it.
- Complete the exit ticket.
Built to the standards you report on
Aligned to the CSTA K-12 Computer Science Standards and the ISTE Standards for Students.
Use file I/O in programs.
Store and retrieve data.
Test file-handling code.
Manage data in programs.
One lesson, every learner
Multilingual Learners
- Read/write diagram.
- Frame: "a file keeps data ___."
- Demo file I/O.
Support & Access
- Read a file only.
- Use a sample file.
- Use a template.
Stretch & Extend
- Read a CSV file.
- Append to a file.
- Handle a missing file.
What to gather
- 📽️Screen / board
- 📄Sample files
- 💻File Input/Output
- 💻Python
- 📓Notebooks
- 🎫Exit-ticket slips
Key terms — hover for a quick definition
Exit Ticket
Preview the three formative checks. Tap “Sample answer” to see what mastery looks like — hide them before you print for students.
Reflect: file input/output.
Have students write data to a file and read it back. A printable file-I/O sheet is in the CS library.
Study the key terms
Tap a card to flip it, then rate whether you knew it. Built from this lesson’s vocabulary.
Nice work!
Check your understanding
A quick self-check with instant feedback, drawn from this lesson’s key terms.
Nice work!
Printable worksheet
A print-and-go review sheet with a built-in answer key. Tap “Show answer key” to reveal answers, or print the clean version for students.
Part A · Write the word that matches each meaning
- a file’s location
- save data to a file
- finish with a file
- reading and writing files
- get data from a file
- access a file
- data that lasts
- auto-closes a file
Part B · Show what you learned
- What does file I/O let a program do?
- How do you save data so it persists?
- What should you do after opening a file?
Part B: 1) Read data from and write data to files. 2) Write it to a file. 3) Close it when done (or use a "with" block).