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 05:00
Which two editions of windows 7 support 64 bit cpus? choose two out of professional, business, starter, or home premium.
Answers: 1
question
Computers and Technology, 23.06.2019 21:20
In microsoft word, when you highlight existing text you want to replace, you're in              a.  advanced mode.    b.  automatic mode.    c.  basic mode.    d.  typeover mode
Answers: 1
question
Computers and Technology, 24.06.2019 00:30
The best definition of an idiom is a. a word or phrase that describes a noun b. a word or phrase describing a verb c. a phrase containing figurative language in which the word expresses a different idea from its exact meaning d. a phrase that compares two unlike objects or ideas
Answers: 2
question
Computers and Technology, 24.06.2019 02:30
Assume a class window with accessor method getwidth that accepts no parameters and returns an integer. assume further an array of 3 window elements named winarr, has been declared and initialized. write a sequence of statements that prints out the width of the widest window in the array.
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
English, 03.11.2019 13:31
Questions on the website: 13722361