Swaggggggg


#1

shopping_list = ["banana", "orange", "apple"]
def compute_bill(food):
total = 0
for f in food :
if stock[f] > 0:
total = total + prices[f]
stock[f] = stock[f]-1
print stock[f]
return total

a = compute_bill(shopping_list)
print a
stock = {
"banana": 6,
"apple": 0,
"orange": 32,
"pear": 15
}

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


#2
shopping_list = ["banana", "orange", "apple"]
def compute_bill(food):
    total = 0
    for f in food:
        if stock[f] > 0:
            total = total + prices[f]
            stock[f] = stock[f]-1 
            print stock[f]
    return total

a =  compute_bill(shopping_list)
print a

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

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

I am assuming that this is for exercise 12