Answer to Question #12756 in Python for Ray

Question #12756
Python 2.7
'count' is a list.
Values...
len(count): 216
count[26]: '20'
count.index('20'): 142
count[142]: 167

I thought count.index('20') should find the value of '20' in the list and return the index of '26'. What am I missing?
1
Expert's answer
2012-08-14T09:36:30-0400
count.index(x) return the index in the list of the first item whose value is x. It is an error if there is no such item.
Probably, the value of the 26th element was 20, but not '20'.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS