11. Making a Purchase


#1

What's wrong with my code???

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

Write your code below!

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


print compute_bill(prices)


#2

Try:
total += prices[key]


#3

Allright, man, it works ...

I then added this at the very end:

print compute_bill(stock)

and it too worked