Loop and python sort completed