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, 24.06.2019 15:30
What is the total number of time zones that can be configured to show by default in a calendar in outlook 2016?
Answers: 1
question
Computers and Technology, 24.06.2019 22:00
Need getting google account back, big issue
Answers: 2
question
Computers and Technology, 25.06.2019 04:00
What was the name of the first computer (machine) language?
Answers: 2
question
Computers and Technology, 25.06.2019 09:50
Part a: data processing given a data file, find the max, min, and average values of columns. also, create an addition column that is based on the other columns. there will be no error checking required for this lab. you are provided with a data file named (surprise! ) data.txt. data is arranged in columns where each item of data is twelve columns wide (so it is easy to extract data items using slicing): name height(m) weight(kg) joe 1.82 72.57 mary 1.60 63.50 dion 1.90 90.71 kayla 1.72 66.31 jose 1.78 70.23 sofia 1.63 65.12 erik 1.98 92.21 sara 1.57 65.77 your task is read the file data.txt and calculate the max, min, and average of the height and weight columns and to add an additional column that has the bmi calculated based on each height and weight. your output will look like this (and needs to be formatted like this). to match the testing on mimir here is the format string: "{: < 12s}{: < 12.2f}{: < 12.2f}{: < 12.2f}"
Answers: 3
You know the right answer?
Use paython basic for two question: 1) Fill in the function shopSmart(orders, shops) in shopSmart....
Questions
question
Mathematics, 21.04.2020 23:40
question
Mathematics, 21.04.2020 23:40
Questions on the website: 13722367