Week 14
More with File I/O
Weekly Summary
This week we don't introduce anything new. We just complete some additional practice with File I/O problems to see how they could work.
Learning Outcomes
There are no new learning outcomes this week. Instead, there are just a few more opportunities to practice doing reading from, and writing to, text files.
Learning Materials
You Try It
- Penny Math and Dollar Words
- Data file: dictionary.txt
- VIDEO: What is Penny Math?
- VIDEO: Writing pennyMath()
- VIDEO: What are Dollar Words?
- VIDEO: Finding all Dollar Words
- Bob Ross Paintings
- Data file: bob_ross_paintings.csv
- VIDEO : Introducing the data set
- VIDEO: Count one column of color data
- VIDEO: Finding the most frequent column
- VIDEO: Using the header data to know what color that is
- VIDEO: Explaining the next challenge - What was Bob's favorite PAIR of colors?
- VIDEO: My solution (Includes a discussion of how to set up the appropriate nested loop and a demonstration of some debugging techniques).
- VIDEO: Ooops. Looks like I made a "Happy Little Accident" (My previous solution is wrong)
Practice Materials
Paired Programming Activity
Please complete the following Paired Programming activity with your assigned partner for the week.
Code Walkthroughs
The following are videos and code solutions for the programs discussed in the Paired Programming Activity. You SHOULD NOT view these until you have either solved the activities yourself - and you want to see how I would do it - or you have tried at least two different times and still are stumped. Don't jump to reading the "correct answer" too quickly. I think it is a GOOD thing to struggle with a problem for a day or two. We improve when we meet and overcome resistance. Learning comes from practice. You need to TRY before jumping to the solutions.
Graded Materials
The following programs are formally graded as problem set 3.4 and are here to assess your progress/competency as a solo programmer. You should work on these individually. While working on these problems, you may refer to your notes, textbook, any programs you wrote, and my videos. However, you should significantly restrict your discussions with classmates. It is moderately acceptable to discuss how you solved a problem in general terms, but you should never show your code to a classmate, whether you are the one struggling or the one helping. You can talk about ideas, but not specific solutions.
You should not be using an AI to assist you with these assignments. Dependence on these will almost certainly come back and hurt you when you take controlled programming competency demos later in the course.
Don't forget about the concept of Rubber Duck Debugging. If you are getting stuck this week you should absolutely pull out your rubber duck and talk to it. YES, you will feel foolish at first. But, again, the research shows that by talking out loud you can often (not always, but often) figure things out on your own. TRY IT!