Could any one tell me where my code went wrong?
You didn't follow instructions... Read them again from the beginning.
Lines 2, 3, 4 and 5 do not make sense to me.
On line 2 for example you are setting the variable,
count (same name as the function) equal to the undefined variable
found. The error message even mentions that
found is not defined.
sequence == item is statement but don't use any control flow instructions like if, while loop etc.
Comment and question - this is how I solved it, but if I didn't check for type, I got the wrong answer (for strings), I notice others didn't check for type. Any ideas on why its working now, but not earlier, when I didn't check for type? I mean, I realize its the conversion of "item" to its true type, did you have to do the same? ...this is from earlier:
So lines 2 on aren't going to work.
You have a variable within your function with the same name. I'm assuming that you want to use that variable as your counter. It would be better to change that to something like:
counter = 0 |setting the initial value to zero.
You're for loop won't work either, you need to loop through each entry in the list.
And finally how does your program determine if the entry is the same as the item, and if it is the same your counting variable needs to increment, otherwise it should remain the same.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.