finish tutorial tasks

This commit is contained in:
2024-06-25 07:47:52 +00:00
parent 1b3eba4657
commit 58c397501a
4 changed files with 13 additions and 6 deletions

3
.gitignore vendored
View File

@ -1,2 +1,5 @@
multiagent1/
__pycache__/
/.vscode
/.devcontainer
/.github

View File

@ -18,6 +18,4 @@ Run python autograder.py
def add(a, b):
"Return the sum of a and b"
"*** YOUR CODE HERE ***"
return 0
return a+b

View File

@ -35,7 +35,9 @@ def buyLotsOfFruit(orderList):
Returns cost of order
"""
totalCost = 0.0
"*** YOUR CODE HERE ***"
for item in orderList:
fruit, numPounds = item
totalCost += fruitPrices[fruit] * numPounds
return totalCost

View File

@ -30,7 +30,11 @@ def shopSmart(orderList, fruitShops):
fruitShops: List of FruitShops
"""
"*** YOUR CODE HERE ***"
return None
best_shop=fruitShops[0]
for show in fruitShops:
if best_shop.getPriceOfOrder(orderList)>show.getPriceOfOrder(orderList):
best_shop=show
return best_shop
if __name__ == '__main__':