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 22:30
You are new to microsoft certification and want to start out by getting a certification geared around windows 8. what microsoft certification should you pursue?
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. peter has launched a website that features baby products. however, clients often find they are unable to access the website because the server is down. which feature of cybersecurity should peter focus on for his website? a. data authenticity b. data privacy c. data availability d. data integrity e. data encryption
Answers: 3
question
Computers and Technology, 23.06.2019 18:00
While inserting images, the picture command is usually used to insert photos from a digital camera, and the clip art command is usually used to a.edit the sizes and other characteristics of photos that have been inserted. b.take a screenshot of an image and copy it to the clipboard for pasting. c.search for drawings or other images from a library of prepared pictures. d.make illustrations using lines and shapes that are easy to manipulate.
Answers: 1
question
Computers and Technology, 24.06.2019 06:30
Some peer-to-peer networks have a server and some don't. true false
Answers: 2
You know the right answer?
Use paython basic for two question: 1) Fill in the function shopSmart(orders, shops) in shopSmart....
Questions
question
Chemistry, 04.01.2021 17:20
question
Mathematics, 04.01.2021 17:20
Questions on the website: 13722360