Lets say I have a list:
L = [15,16,57,59,14]
The list contains mesurements, that are not very accurate: that is the real value of an element is +-2 of the recorded value. So 14,15 and 16 can have the same value. What I want to do is to uniquefy that list, taking into account the mesurement errors. The output should therefor be:
l_out = [15,57]
or
l_out = [(14,15,16),(57,59)]
I have no problem producing either result with a for loop. However, I am curious if there could be a more elegant solution. Ideas much appriciated.