My code
[code=python]
s=['aaaa','ccccccc c','dddd','ssss ','xxxxx','aaaa ','ssx','ssx',' cc','cc']
for k in range(len(s)):
st=s.count(s[k])
if st>=2:
print s.pop(s.index(s[k]))
Traceback (most recent call last):
File "C:/Python30/test.py", line 4, in <module>
st=s.count(s[k])
IndexError: list index out of range
[/code]
how can I fix the error
IndexError: list index out of range
[code=python]
s=['aaaa','ccccccc c','dddd','ssss ','xxxxx','aaaa ','ssx','ssx',' cc','cc']
for k in range(len(s)):
st=s.count(s[k])
if st>=2:
print s.pop(s.index(s[k]))
Traceback (most recent call last):
File "C:/Python30/test.py", line 4, in <module>
st=s.count(s[k])
IndexError: list index out of range
[/code]
how can I fix the error
IndexError: list index out of range
Comment