I have a list sorted in ascending order. I want to find the duplicates in the list by comparing elemnt i with element i+1. I have tried other methods that worked.For example the double loop, but I want to use this method since I am learning python and want to understand why my code is not working.
This is my code:

```
array=[1,1,2,3,3,4,5,6]
def find_duplicates(arr):
  duplicates=[]
  sorted=  sort(arr) #helper function that succesfully sorts a list

  for i in range(1, len(sorted)):
      #before=sorted[i-1]
      if i==sorted[i-1]:
          duplicates.append(i) #tried also duplicates.append(sorted[i-1])

  return duplicates #expected: [1,3] 

print(find_duplicates(array)) #actual outcome [1]

```

I am only getting the firts duplicate in appended to my array.
your suggestions will be highly appreciated.
Thank you.