Added a Python solution using a class.

This solution avoids the state problems that the other function based
solutions have, as evidenced by the examples printed at the bottom.
Merge pull request #23 from rockymeza/class-based-python

Added a Python solution using a class.