Working through Project Euler in Python