Today I learned that converting an ordered list to a set and back to a list does not maintain the original order.

>>> [32.0,36.0,39.0,40.0]
[32.0, 36.0, 39.0, 40.0]

>>> set([32.0,36.0,39.0,40.0])
{32.0, 40.0, 36.0, 39.0}

>>> list(set([32.0,36.0,39.0,40.0]))
[32.0, 40.0, 36.0, 39.0]

September 13, 2021 Python


Previous post
Find the difference between two dictionaries/json Use Python to find the difference between two dictionaries with nested dictionaries
Next post
Find Duplicates in a List