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'.
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment