Fill: Open File for Reading
Fill in the Blank Easy
Question
Fill in the blank to open the file in read mode.
Code
f = open("data.txt", "___")
Hint
The single-letter mode for reading is...
Explanation
Mode 'r' opens the file for reading (the default mode). The file must exist, otherwise FileNotFoundError is raised. Use 'w' for writing, 'a' for appending, 'rb' for binary reading.
Related Resources
Related Lessons
- File Handling
File modes.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.