Activity 01
Pair Programming: Name Sorter Challenge
Pairs create a text file with 20 unsorted names, then write code to open it, read lines into a list, sort alphabetically, and print. Switch roles midway to debug path or stripping issues. Extend by writing sorted names to a new file.
Explain the steps involved in reading data from an external file into a Python program.
Facilitation TipDuring Pair Programming: Name Sorter Challenge, circulate to ensure pairs alternate typing every two lines to keep both engaged in the logic.
What to look forProvide students with a small text file (e.g., a list of cities). Ask them to write the Python code to read the file and print the third city name. Also, ask them to write one sentence explaining what would happen if the file name was misspelled.