[Solved] Why sorting mixed list does not work [closed]


The problem is in your original data:

>>> [-131.23, 33213, 4454, 566, -33, 465. -377.312, 5.6656]
[-131.23, 33213, 4454, 566, -33, 87.68799999999999, 5.6656]

because you forgot the comma and this does the substraction:

>>> 465. -377.312
87.68799999999999

Just add the comma:

>>> sorted([-131.23, 33213, 4454, 566, -33, 465, -377.312, 5.6656])
[-377.312, -131.23, -33, 5.6656, 465, 566, 4454, 33213]

2

solved Why sorting mixed list does not work [closed]