Problem with fizz_count


def fizz_count(x):
count = 0
for item in x:
if item =='fizz':
count = count+1
return count

Error showing for this code as- " Oops, try again. fizz_count([7, 'fizz', 'fizz', 'fizz', 'fizz']) returned 0 instead of the correct answer: 4 "

List and Functions

That code won't return even 0, it isn't valid syntax. Make sure it's intact in your post.

You could print out what it's doing step by step for the input that your error message mentions to narrow down where things go wrong.


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