The code reading/welcome back activity from last week's blog went well and the students enjoyed it and felt that it was helpful. They have asked for more of this, so my plan is to alternate between subgoal labeling and code reading to introduce new topics for the second semester.
Peanut Butter Jelly Time
This week is one of my favorite weeks of the year! The Exploring Computer Science class is beginning its nine weeks of coding. I tell students how my first programming class in high school (Apple BASIC) got me hooked and led to a college major that I thoroughly enjoyed and then to a
But before we start programming I take a day to introduce some terms and concepts by having the students write instructions for making peanut butter and jelly sandwiches. The students work in pairs so they can begin seeing what paired programming will feel like. Inevitably, the first confident pair reads their instructions and correctly remembers to take the plastic tab off of the bread bag but forgets to untwist the closed bag. I let the pair make one change "on the fly". At that point, the bread slices are out of the bag and on the plate and the next typical error is that students instruct the computer to turn the peanut butter jar lid counter clockwise. But without picking up the jar first the lid simply spins the jar around and around on the table. They have fun and we learn several different computer terms that we use the following day.
Students learn that making the sandwiches has instructions and that some of the instructions operate on things. We talk for a bit about Python being a language that has instructions and that some of these instructions need parameters. We pick up a jar and unscrew a lid. I don't show these as instructions like pickup(jar) and unscrew(lid). This may be an idea for next year. We also talk about the idea of iterative development and that as we learn new things and figure things out we go back and refine programs and make them better in the same way that we made a better set of instructions that got us closer and closer to that peanut butter sandwich. As students get close and think they have the full set of instructions, someone runs into a problem and exclaims "But that isn't what I meant!". This is another good stopping point to remind that students that with programming many things can be intuitive but sometimes instructions don't always work the way we think they should.
Python print() and numbersThe first day of instruction and practice is easier having doing the fun activity first and introducing many of the terms that we use. We use Idle to enter in instructions and see how they run and begin with print() instructions. We print strings first and spend time making sure everyone can find the parentheses and quotation marks on the computer keyboard. Then we move into numbers and talk about keys that represent the operators. It takes time to make sure that everyone can find all of the correct keys. We put the operators together and do a quick refresher on PEMDAS and discuss that computers follow the same operator precedence that we do. We finish off the instruction by having the students learn that the comma can be used to print more than one string or number or operation.
I use the snakify.org website to have the students practice. Snakify is divided into theory, steps, and practice. I prefer to walk through examples with the students instead of using the theory section. But I have students complete all of the steps and then work in pairs to complete the practice problems. Then I finish off each lesson with a small project. For the first lesson we typically use ASCII art with sets of print() statements.
After the first lesson, it is usually fairly easy to see the students that are hooked, and then it is time to try to add to that number.
Royalty Free images from Pixabay.com