Count. What did i do wrong?


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/learn-python/lessons/practice-makes-perfect/exercises/count?action=lesson_resume

<In what way does your code behave incorrectly? Include ALL error messages.>
Your code looks a bit off–it threw a “invalid literal for int() with base 10: ‘one’” error. Check the Hint if you need help!

<What do you expect to happen instead?>
i expect it to work.

def count(sequence, item):
  x = 0
  for i in sequence:
      if i ==item: # should i use int(item)
          x+=1
  return (x)

#2

I tested your code and it works fine. Try refreshing the page.


#5

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