# -------
# Licensing Information: Please do not distribute or publish solutions to this
# project. You are free to use and extend these projects for educational
# purposes. The Pacman AI projects were developed at UC Berkeley, primarily by
# John DeNero ( and Dan Klein (
# For more info, see

class FruitShop:

    def __init__(self, name, fruitPrices):
            name: Name of the fruit shop
            fruitPrices: Dictionary with keys as fruit 
            strings and prices for values e.g. 
            {'apples':2.00, 'oranges': 1.50, 'pears': 1.75} 
        self.fruitPrices = fruitPrices = name
        print 'Welcome to %s fruit shop' % (name)
    def getCostPerPound(self, fruit):
            fruit: Fruit string
        Returns cost of 'fruit', assuming 'fruit'
        is in our inventory or None otherwise
        if fruit not in self.fruitPrices:
            print "Sorry we don't have %s" % (fruit)
            return None
        return self.fruitPrices[fruit]
    def getPriceOfOrder(self, orderList):
            orderList: List of (fruit, numPounds) tuples
        Returns cost of orderList. If any of the fruits are
        not available in the inventory, simply ignores them
        in the cost calculation.  
        totalCost = 0.0             
        for fruit, numPounds in orderList:
            costPerPound = self.getCostPerPound(fruit)
            if costPerPound != None:
                totalCost += numPounds * costPerPound
        return totalCost
    def getName(self):