add functional python solution without global state
Merge pull request #28 from xchrdw/master

add functional python solution without global state