need help I was trying to do a program which could eliminate numbers which repeats themselves in a list the program below works but it gives me an error can you please try to find the problem as have I tried to check where the problem is but i couldn't find the solution
[1, 5, 10, 16, 20]
Code:
>>> a = [1,1,1,5,10,10,16 ,16 , 20]
>>> n = 0
>>> b = len(a)
>>> while n < b:
while a[n] == a[n+1]:
a.pop(n+1)
while a[n] != a[n+1]:
n += 1
b = len(a)
1
1
10
16
Traceback (most recent call last):
File "<pyshell#27>", line 4, in <module>
while a[n] != a[n+1]:
IndexError: list index out of range
>>> a
Comment