Learning standard algorithms in Introduction to Python allows students to investigate the quirks of the English language.

We have two main goals in Introduction to Python, and sometimes it’s difficult to achieve these simultaneously. On the one hand, we want students to have fun, be creative, and enjoy the subject! Graphics-based programming is one way to reach this goal, and in my previous post for this class, I described some of the work we were doing with Python turtle graphics.

However, it is also important for introductory computer science students to learn some of the standard algorithms used to accomplish various tasks, and that was the emphasis of this class for the first part of block 3. In particular, given a list of integers, students learned how to write code to answer the following questions about the integers in the list:

  1. What is the arithmetic mean of all the integers?
  2. How many integers in the list are positive?
  3. What are the smallest and largest integers in the list?
  4. Are the integers in the list ordered from smallest to largest?
  5. Does the list contain duplicates? Or are all the integers in the list distinct?

Later in the block, to make this material more interesting and to allow for some creativity, students learned how to have their Python programs read information from an external text file. Students then wrote programs to read text files consisting of all the words in an English language dictionary, and answer various questions about those words. Some of these questions appear below. I wrote some of them, and others were created by the students. Answers (at least for the dictionary we used) appear immediately below if you'd like to try some of them!


  1. What is the longest word that is a palindrome?
  2. What is the longest word containing none of the letters 'a', 'e', 'i', 'o', or 'u'?
  3. What is the longest word whose letters are all in alphabetical order?
  4. In our dictionary, no word contains a double x. However, another letter appears doubled in exactly one word. What letter is that, and what is the word?
  5. What is the longest word consisting only of letters in the first half of the alphabet?


  1. "malayalam" (a language spoken in India)
  2. "symphysy" (the fusion of two bodies, or two parts of a body)
  3. "adelops” (a genus of beetles)
  4. Exactly one word contains a double q. It's "zaqqum", a tree referred to in the Quran.
  5. "hamamelidaceae" (a family of shrubs and trees)

--Steve Gregg