Meet the Teacher: Pam Rissmann

Welcome to Meet the Teacher – CodeMonkey’s blog segment where teachers from all over the world share their experiences on what it’s like being an educator. Today’s post features Pam Rissmann, a STEM teacher at Dartmouth Middle School, San Jose, CA

Banana Tales Plot Twist: Let’s Code Some Math

I am a middle school STEM Teacher, and I teach computer science as well as robotics and product design. Additionally, I am our school’s Math Club coach. Last year I wanted to offer a STEM class before school, a true elective that would be open to 6th, 7th, and 8th graders. I decided to combine my love of math with my passion for coding, and offered the class, ‘Math Puzzles and Coding’.

My goal for the class is for students to think through the strategies for solving Math Olympiad type problems, which are more like puzzles than traditional classroom math problems. I also wanted to teach them Python by using CodeMonkey’s Banana Tales, and to show the students that the Python skills we learn in Banana Tales are useful for other things besides banana delivery. In fact, we could use Python to solve our math puzzles.

The general structure of the class is to begin with a few math puzzles, then students share out their methods for solving the puzzles, and then we move onto CodeMonkey’s Banana Tales challenges. Once the students learned enough basic Python syntax, around the 35th challenge, then we started coding the math.

We started by coding the math in the Banana Tales environment. We just commented out an existing challenge, and wrote our math code there instead. We coded the math, so the answer would be printed in the console. For example, this (figure 1)  is how we used Python to find the perfect squares less than 100.

Figure 1. Code for printing out perfect squares less than 100

I think coding up the math puzzles helped reinforce the Python concepts like: for loops, if statements, lists, and other concepts that are closely tied to the Banana Tales “game”. It helped the students realize that these constructs are general purpose methods, and are not just to be applied to giraffes, elephants, etc. in the Banana Tales challenges.

Coding up math puzzles in Python were also a great launchpad for thinking about the math in different ways and for learning other Python commands as a part of the problem-solving process.

For example, we solved this puzzle first with pencil and paper: 

How many integers between 100 and 1000 contain only the digits: 3, 4, or 5?

On paper, we know the numbers must be between 300 and 599. We also know that it is best if we organize our thinking, because often a pattern arises when we do that. Listing out the numbers in the 300s, we get:  333, 334, 335, 343, 344, 345, 353, 354, 355. Now that same number of solutions must exist in the 400s and 500s. So 9 x 3 = 27 integers.

Coding this problem is actually very different from solving it with pencil and paper, since we want the computer to analyze each digit of the number, which isn’t what it is used to doing. We have to figure out how to decompose a 3-digit number into its individual digits. In other words,  how do we get the computer to just look at the hundreds value or tens value or the ones (unit) value? We found two ways of doing it, but there’s probably even more ways.

First (Fig.2)  method was to use division(/)  and modulo/remainder (%) to get at the different digits. The second way (Fig 3) was to convert the integer into a string, and then to look at each character (digit) of the string. 

Figure 2 – Used division and modulo operators to extract the individual digits from the integer, i.
Figure 3: Converted the integer, i, to a string, and then analyzed each digit

I think what I like most about coding math problems is that it helps the students understand the math problems more because they have to “teach” the computer to solve them. Some of my students really took off with this, and started asking me for more math problems to code at home. I eventually discovered, a website dedicated to coding math problems! Once registered with the site, you are given math problems to code and solve, and there is a community who you can share your insights with as well as your questions. 


Pam Rissmann is a middle school STEM teacher who teaches computer science, robotics, and product design. She has been teaching for 15 years, and in addition to teaching, she coaches her school’s competitive math club and STEM Girls club. Pam is a recipient of the Santa Clara County/Texas Instruments STEM teacher award and California League of Middle School Teacher of the Year for her school. Pam was awarded by Project Lead the Way the Outstanding Gateway Teacher award in 2019. Follow Pam on Twitter: @pperfectsquares

Try CodeMonkey at home or at school!

free trial


for your school / district

More to explore:

stem kindergarten

Stem lessons for kindergarten

STEM stands for science, technology, engineering, and math. It’s important for children to understand these subjects, or else they won’t be prepared

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to CodeMonkey's blog

Stay Up To Date on The Latest NEWS