subject

Use paython basic for two question: 1) Fill in the function shopSmart(orders, shops) in shopSmart. py, which takes an orderList (like the kind passed in to FruitShop. getPriceOfOrder) and a list of FruitShop and returns the FruitShop where your order costs the least amount in total. Don't change the file name or variable names, please. Note that we will provide the shop. py implementation as a "support" file, so you don't need to submit yours.
For example, with the following variable definitions:
orders1 = [('apples',1.0), ('oranges',3.0)]
orders2 = [('apples',3.0)]
dir1 = {'apples': 2.0, 'oranges':1.0}
shop1 = shop. FruitShop('shop1',dir1)
dir2 = {'apples': 1.0, 'oranges': 5.0}
shop2 = shop. FruitShop('shop2',dir2)
shops = [shop1, shop2]
shopSmart. shopSmart(orders1, shops) == shop1
and
shopSmart. shopSmart(orders2, shops) == shop2
shop Smart .py Heres the intended output of this script, once you fill it in: Welcome to shop1 fruit shop Welcome to shop2 fruit shop For orders apples 1.0) oranges 3.0) best shop is shop1 For orders apples 3.0) best shop is shop2 import shop def shopSmart (orderList ruit Shops) order List List of (fruit, numPound) tuples fruit Shops List of Fruit Shops YOUR CODE HERE return None problem data orders apples 1.0) oranges 3.0 j dir1 apples 2.0, oranges 1.0) shop1 hop Fruit Shop shop1 dir1) dir2 apples 1.0, oranges 5.0) op2 hop Fruit Shop shop 2 dir2) shops [sh shop2 op j
2) Add a buyLotsOfFruit(orderList) function to buyLotsOfFruit. py which takes a list of (fruit, pound) tuples and returns the cost of your list. If there is some fruit in the list which doesn't appear in fruitPrices it should print an error message and return None.
DO NOT change the fruitPrices variable.
For example,
Cost of [('apples', 2.0), ('pears', 3.0), ('limes', 4.0)] is 12.25

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 00:30
These tools give presenters more freedom to move about the room and interact with their audience. laptop computer laser pointer lcd projector remote control
Answers: 2
question
Computers and Technology, 22.06.2019 17:40
Gabe wants to move text from one document to another document. he should copy the text, paste the text, and open the new document highlight the text, select the cut command, move to the new document, make sure the cursor is in the correct location, and select the paste command select the save as command, navigate to the new document, and click save highlight the text, open the new document, and press ctrl and v
Answers: 1
question
Computers and Technology, 22.06.2019 22:00
What is a distinguishing feature of today’s graphic application software?) graphic applications are used today on a variety of devices, including touch-screen kiosks and mobile phones.
Answers: 3
question
Computers and Technology, 23.06.2019 06:10
The head restraint should be adjusted so that it reaches a.the top of your ears b.the base of your skull c.the top of the head
Answers: 1
You know the right answer?
Use paython basic for two question: 1) Fill in the function shopSmart(orders, shops) in shopSmart....
Questions
question
Mathematics, 14.05.2021 17:40
question
Health, 14.05.2021 17:40
question
Mathematics, 14.05.2021 17:40
question
Mathematics, 14.05.2021 17:40
question
Mathematics, 14.05.2021 17:40
question
Mathematics, 14.05.2021 17:40
Questions on the website: 13722362