compare within list and check the highest code example
Example: python compare each item of one list
import itertools
for a, b in itertools.combinations(mylist, 2):
compare(a, b)
import itertools
for a, b in itertools.combinations(mylist, 2):
compare(a, b)