Lists + functions error


#1



https://www.codecademy.com/courses/python-beginner-en-IZ9Ra/0/4?curriculum_id=4f89dab3d788890003000096#


code looks fine but i get the following error:
Oops, try again. fizz_count(['fizz', 'buzz']) returned 0 instead of the correct answer: 1


def fizz_count(x):
    count=0
    for item in x:
        if item=='fizz' :
            ++count
    return(count)
    
fizz_count(["fizz","cat","fizz"])


#2

to increment count by 1:

count = count + 1

or

count += 1


#3

thanks. thought i'd seen somewhere that python supports ++,--, etc. operators same as javascript


#4

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