Sum Square Difference solution in python