So ive had a search and come to a standstill. I'm trying to iterate through a list and where entries appear n number of times remove those entries. the looping and clearing isn't a problem its the n entry. Im trying to use raw code rather than libraries. Any suggestions or pointers would be greatly appreciated! below is what i have been toying with. i have left it at the data.remove line as this is where i perceive i am lost!
n=2
Data =({1, 2, 2, 3, 3, 3, 4, 5, 5}, 1)
def remove_dup(a):
i = 0
while i < len(a):
j = i + 1
while j < len(a):
if a[i] == a[j]:
Data.remove[j] where j==n
else:
j += 1
i += 1
remove_dup(Data)
print(Data)
Aucun commentaire:
Enregistrer un commentaire