Project Euler Hackerrank Solution Python