Implement p0 tutorial.
This commit is contained in:
@@ -28,8 +28,10 @@ def shopSmart(orderList, fruitShops):
|
||||
orderList: List of (fruit, numPound) tuples
|
||||
fruitShops: List of FruitShops
|
||||
"""
|
||||
"*** YOUR CODE HERE ***"
|
||||
return None
|
||||
|
||||
prices = [(shop.getPriceOfOrder(orderList), shop)
|
||||
for shop in fruitShops]
|
||||
return min(prices)[1]
|
||||
|
||||
if __name__ == '__main__':
|
||||
"This code runs when you invoke the script from the command line"
|
||||
@@ -39,6 +41,6 @@ if __name__ == '__main__':
|
||||
dir2 = {'apples': 1.0, 'oranges': 5.0}
|
||||
shop2 = shop.FruitShop('shop2',dir2)
|
||||
shops = [shop1, shop2]
|
||||
print "For orders ", orders, ", the best shop is", shopSmart(orders, shops).getName()
|
||||
print("For orders ", orders, ", the best shop is", shopSmart(orders, shops).getName())
|
||||
orders = [('apples',3.0)]
|
||||
print "For orders: ", orders, ", the best shop is", shopSmart(orders, shops).getName()
|
||||
print("For orders: ", orders, ", the best shop is", shopSmart(orders, shops).getName())
|
||||
|
||||
Reference in New Issue
Block a user