for nums in a:
for b in range(len(newlist)):
for c in range(1,len(newlist)):
if a[b] == a[c]:
so my code is ment to look for numbers other than the one being com paired to by cycling through two lists. b is the first index number for example on the test [4,5,5,4] I want it to run like this.
b in range (len(a)) goes to b = [0,1,2,3]
for b = 0. c=range(1,len(a)) which should go to c=[1,2,3]
giving b=0 and c=1
if a[b] == a[c]
if a == a
4=5 ,false. It then goes back to the for loop.
4=5 ,false once again repeat the loop.
4==4 ,true executes the then statement.
del newlist[c] which was filled earlier with the numbers from the list so that we arn't changing the initial list. [4,5,5,4]
del newlist, new list should now contain [4,5,5] and after completing the for loop go back to the b for loop and go to b= then find the corresponding 5 and delete that one.
but instead i get error:"list assignment index out of range"
where did i go wrong?