Area professor introduces students to Python

After a couple of years of building up the courage to try, I finally attempted to incorporate computer programming in my mathematics classes. The reasons for doing so are two-fold:

  1. Computers are everywhere, and it seems like an educated person should have some experience in programming them.
  2. Programming is a fantastic tool for getting students to understand algorithms.

In particular, I am teaching elementary education majors this semester, and I am starting by having them code the standard addition algorithm for base six numbers. Here is how I set up the exercise:

  1. I reserved a classroom set of laptop computers for the day.
  2. I decided to use Python. This is because it is a useful language, the syntax is relatively minimal, and it is relatively easy to read.
  3. My students were to input numbers as lists; furthermore, I made the requirement that their program only work with four digit numbers. That is, 1234+45 would be inputted as [1,2,3,4]+[0,0,4,5]. These were both done to eliminate the coding that would not help them understand the algorithm better.
  4. I coded up a similar base six subtraction algorithm. I gave them a copy of my code to help them get started on the addition algorithm (the addition algorithm is substantially easier to code). (I also gave them a copy of a program that will take a sum of numbers of arbitrary length—not just four-digit numbers. I still, however, kept the inputs as lists).
  5. My school does not have a Python interpreter on its network, and I cannot request one until the summer (there are only two times per year that I can request software—before each semester). Instead, I decided to use Sage Online as my interpreter.

I explained this plan to my students, and they seemed game. However, there was a serious problem with using Sage Online. For some reason—perhaps because all of the computers were being funnelled through the same wireless router—one student could see everyone else’s worksheets on Sage, and no one else could see any worksheet.

At this point, I decided to delay the programming project until Monday. Then, I will attempt the same process, only using codepage instead of Sage Online.

Does anyone have a suggestion for how to improve this?

Tags: , , , , ,

2 Responses to “Area professor introduces students to Python”

  1. Alex Says:

    Does your school’s computers have Matlab or Java installed? Those are two very readable languages. You could also check out Kodingen ( which allows for individual accounts and offers online development in many different languages. I think with the user accounts you would avoid the issue of all students seeing the other students work. Just a thought.

    Good luck Bret, let me know what ends up working for you.

  2. bretbenesh Says:

    Hi Alex,

    We have both MatLab and Java, although I object to these for two different reasons. First, I have an objection to the fact that MatLab is not free. If a student wants to use their programming skills later in life, they need to either spend money on MatLab or adapt to a different language (not a problem for programmers, but my students are not programmers).

    I think that Java has a considerably higher entry point than Python. I think the fact that you have to define a class to do anything is a longer discussion than I would like to have with my freshman elementary education majors.

    Finally, I (1) do not know MatLab myself and (2) do not remember much Java. This, combined with general laziness, pushes me toward Python.

    I appreciate the Kodingen reference. This, combined with (from one of my students), gives me three options for Monday. One of them should work.

    Thanks, Alex. I am hoping to call you and Trapper this weekend.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: