File I-O

Domain: Programming Fundamentals

🎯 Motivation

Programs need to save and load data - reading a config file, saving game progress, writing a log.

πŸ“‹ Concrete Example

with open('scores.txt', 'w') as f: f.write('Alice: 100'). Reading: with open('scores.txt') as f: data = f.read().

πŸ”— Analogy

A notebook - you write down information (write to file) so you don’t forget it. Later, you open the notebook and read it back (read from file).