A Day at the Supermarket; problem with parentheses


Hey guys, I have accomplished this task, although I want to know - why does this code prints 1 when I just simply swap the [] with {} ?!
this code runs fine and prints '2' which is expected.

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




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