solutions for thinkpython