Help on the Link + Functions


#1

Hi everyone, I am a little confused at what I am doing wrong here. I am getting the answer 0 instead of 1 and I am not really sure how.

I am new to this and would appreciate any help at all.

Thank you again,
M


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


#2

here:

count == count + 1

to update/re-assign a variable, you use a single equal sign. Two equal signs means compare


#3

count = count + 1
u wrote count == count + 1


#4

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