Apr-26-2022, 11:24 PM
Looking at it, I believe the difference is not in sorted, but rather in the order of the dictionary. Early versions of Python did not guarantee the order of items in a dictionary. And, indeed, your result is clearly not sorted in 2.7 (not supported in many years).