What's wrong with my code? A day at the supermarket 9/13


#1

it says "opps try again. it looks like your code did not print the corrent total"

def something():
    total = 0
    for key in prices:
        total = total + stock[key] * prices[key]
    return total
    print total

#2

why did you create a function? you can use a function, that is fine, but then you need to call it, otherwise it won't execute:

def something():
    total = 0
    for key in prices:
        total = total + stock[key] * prices[key]
    return total
    print total
something()

then you need to realize that a function ends the moment a return keyword is reached, which leaves you with two options:

move the print total to before the return total
add a print statement to the function call


#3

yea i fixed it, thanks anyway


#4