solved double-squares in python