File Operations
Creating, writing, reading a file with with open(), and the append modes (w / r / a).
Simple enough for a 5-year-old to understand
Write to and read from a file
with open(...) opens the file and closes it automatically when done. "w" is write mode, "r" is read mode.
with open("not.txt", "w") as f: f.write("Hello file")with open("not.txt") as f: print(f.read())🎯 Exercise & Practice
Test what you've learned — answer, write code, check instantly. (1 left)