11. count (11/15) Help needed :'(


What’s wrong with the code below? Everything seems fine when I print and check, but the lesson insists that there is something wrong :confused:

def count(sequence, item):
  print sequence, item
  count = 0
  while item in sequence:
    count += 1
  print count
  return count


i don’t think the exercise likes the removal of items from sequence

We only need to count the number of items in the list, why would we remove them from the list? Its not very efficient.


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