Activity 01
Pair Programming: Text Formatter Challenge
Pairs get sample text with errors, like mixed case names and extra spaces. They chain methods: strip(), lower(), replace() to clean it, then join() with delimiters. Test on five inputs and discuss efficiency.
Differentiate between string methods that return a new string and those that check properties.
Facilitation TipDuring Pair Programming: Text Formatter Challenge, remind students to take turns typing and explaining each line to ensure both partners understand the code.
What to look forProvide students with a short paragraph of text. Ask them to write three lines of Python code using string methods to: 1. Convert the entire paragraph to lowercase. 2. Count the number of words in the paragraph. 3. Replace all occurrences of a specific word with another.