Project Euler Hackerrank Solution Python Snake