I am trying to delete duplicate elements in a array. There are lots of methods out there but I am trying to come up with my own one and tried the folllowing code.
x=[2,1,3,5,3,5]
for i in range(0,len(x)):
  for j in range(0,len(x)):
      if (x[i]==x[j+1]):
           del x[j+1]
for k in range(0,len(x)):
    print(x[k])
I get the following error at line 4 list index out of range.
Please help me!
 
    