# List + Functions = confusing but I got it

#1

I'm going through the exercises as I can but some things are either not explained or vaguely hinted at and it's throwing me off. As a result I seem to be overcomplicating my code. The "List + Functions" part had me confused and searching only gave me results that confused me even more.

In the exercise it does not specify that you create the list for "fizz_count()" to use yet forums topics had people creating variables for it and when I tried it would throw up an error. In the end I used the code below and saw that the exercise itself gives input to the code. Why is this not stated clearly? I can't be the first person to be confused by this although I am the first in the recent posts it seems.

At one point I was so close but I was adding more code instead of making sure what I had written was correct. It turns out that my problem was having

``````    for item in x:
if item == "fizz":
count = count + 1
return count``````

``````    for item in x:
if item == "fizz":
count = count + 1
return count``````

I know it's not a question that can be answered with "oh it's this" but I am wondering why do some exercises leave out key details like the fact that the exercise will be giving your code input and it isn't shown on screen? Am I missing something? I am more than willing to admit I may have missed something obvious but it seems like a lot of other people just created the input. I'm trying to learn this but it feels like the instructions could be explained more clearly.

``````# Write your function below!
def fizz_count(x):
count = 0
for item in x:
if item == "fizz":
count = count + 1
return count``````

#2

Thank you soooo much i was having the same problem! I didn't know they already defined "item". Thanks for the help!

#3

I'm glad it helped. I wonder if the exercises are written by people very familiar with the code because they assume too much sometimes and my simple brain encounters an error it can't continue past.

#4

Thank you a second time -- Confusing that I could not figure out where the wrong "fizz" counts were coming from if not in my list, especially since I didn't use "buzz" at all & couldn't initialize or overwrite it... Mystery solved, moving on...

#5

thanks a bunch. Same problem and issue as you had, so you are not alone haha

#6

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