Lists + Functions


Idk... what did i do wrong... i keep messing up.. i need a teacher :(, someone please help me.. please

"Oops, try again. fizz_count(['fizz', 'fIzZ', 'fizz', 'fizz', 'fizz']) returned 1 instead of the correct answer: 4"

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


Can you find anything unusual at last line of code?


The indent -.-..... fek me.. thanks


It happens!! No worries :slight_smile:
Keep up the good work! :thumbsup:


Thanks, sorry, not to bother u again, but i need to to explain something to me that i dont get. Here is the link


Okay we defined two dictionaries there..
One dictionary tells that what are the prices of each fruit.
Other dictionary tells numbers of each fruit available in their stock .

Now in this exercise what you've to do is..
You have to print something like this...

fruit name
price: someNumber
stock: someNumber

For eg for apple o/p should look like this...

price: 2
stock: 0

You have to print same thing for every fruit! (name,price and stock)
I will strongly suggest you to read out the theory and instruction!
Hope it helps!
do reply if it helped you or not! :slight_smile:


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