Making a Purchase


shopping_list = ["banana", "orange", "apple"]

stock = {
    "banana": 6,
    "apple": 0,
    "orange": 32,
    "pear": 15
prices = {
    "banana": 4,
    "apple": 2,
    "orange": 1.5,
    "pear": 3

def compute_bill(food):
    for key in food:
        total+= prices[key]
        return total


Please show us your code with indents. Paste your code, select it and press Ctrl + Shift + C or even better place it between three backticks/backquotes before your code and three backticks/backquotes after your code.
Without proper indents I can't say what may be wrong.


whoops! Sorry about that, I went and fixed it, thanks


Ok, try with changing indentation of return to the same level as for has. This seems to be the only issue.


omg X_x it's always one little thing, isn't it?

Thanks a bunch!