You are not iterating over the keys and values as you think. Rather, this is unpacking each tuple in the list and assigning its first component to i and its second component to x. You are then accessing the element at the ith position in the list, which leads to what appears to be a random ordering. You can instead write:

for i, x in enumerate(sorted_list):

Or more simply, you can print the tuple you are trying to display

for item in sorted_list:
print(item)

Email codedump link for list.sort() not sorting values correctly by second tuple parameter