Activity 01
Pair Programming: Score Logger
Pairs write a program that prompts for a name and score, appends it to a text file, then reads and prints all scores. Add try-except for file errors. Pairs test by running multiple times and swapping files to simulate shared data.
Analyze the process of reading data from a file and writing data to a file.
Facilitation TipDuring Pair Programming: Score Logger, circulate to ensure both partners take turns driving and navigating, reinforcing collaboration while they debug file errors together.
What to look forPresent students with a short Python code snippet that attempts to read from a file. Ask them to identify potential errors and explain what might happen if the file does not exist or is empty. 'What is the expected output of this code? What happens if 'my_data.txt' is missing? How could we prevent this error?'