1st attempt - from http://www.cse.msu.edu/~cse231/PracticeOfComputingUsingPython/