Activity 01
Pair Coding: Seek and Insert
Pairs open a sample text file in 'r+' mode. They use tell() to record initial position, seek(50, 0) to move to byte 50, write a string, then seek(0, 0) and read to verify changes. Pairs exchange files to test each other's code.
Explain the concept of a file pointer and its role in file operations.
Facilitation TipDuring Pair Coding, circulate and ask each pair to explain why they chose a specific whence value before running their code.
What to look forPresent students with a small text file and a series of Python commands involving `seek()` and `tell()`. Ask them to predict the output of `tell()` after each operation and explain their reasoning for the pointer's movement.