Lists + Functions


#1



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


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


"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


#2

hint**
Can you find anything unusual at last line of code?


#3

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


#4

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


#5

Thanks, sorry, not to bother u again, but i need to to explain something to me that i dont get. Here is the link
https://www.codecademy.com/courses/python-beginner-en-IZ9Ra/1/3?curriculum_id=4f89dab3d788890003000096


#6

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...

apple
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:


#7

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