Getting this error. I'm not dealing with strings anywhere I don't believe, so the error isn't really helping me.


When we write,

for i in sequence:

i is not the index, but the value. sequence.index(i) is the index.

When we write,

for i in range(len(sequence)):

then i is the index.


Thanks for the response, but im getting this error now. Tested in seperate IDE and got the same thing


If we are only comparing values, we don't need an index.

for value in sequence:
    if value == item:

It is also not necessary to sort. The order does not matter.


My problem believe it or not, was just that the print count and return count was "count" and not "counter". Switched both and it worked


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.