Problem ten in Ruby.  I should start doing these in Python, maybe