What is the problem with this code? The debugger says: Oops, try again. Your code did not run to the end. Check the console window for errors


#1

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

stock = {
"banana": 6,
"apple": 0,
"orange": 32,
"pear": 15
}

prices = {
"banana": 4,
"apple": 2,
"orange": 1.5,
"pear": 3
}

Write your code below!

def compute_bill(food):
total = 0
for food in food:
total += food
return total
n = [1, 2, 5, 10, 13]
print compute_bill(n)


#2

Set a different iterable variable: Eg.,

    for item in food:
        total += prices[item]

Use your shopping_list...

print compute_bill(shopping_list)

#3

there is still a problem I have with the new code you gave me.

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

stock = {
"banana": 6,
"apple": 0,
"orange": 32,
"pear": 15
}

prices = {
"banana": 4,
"apple": 2,
"orange": 1.5,
"pear": 3
}

Write your code below!

def compute_bill(food):
total = 0
for item in food:
total += prices[item]
n = [1, 2, 5, 10, 13]
print compute_bill(n)
print compute_bill(shopping_list)


#4

Remove those two lines.