What are some of the ways to optimize the following code?
def countit(numericals=[1, 1, 2, 2, 3, 3], h=1): pol = 0 sort = list(dict.fromkeys(numericals)) for x in sort: dodaj = x + h for y in sort: if dodaj == y: pol = 1 + pol else: pass return pol print(countit()) The code checks if there are any "pairs" in the list with my additional variable in that case h = 1. So h + any element from the list = any element from the list it's a pair.