Write and test the function by_origin( foods, origin) in the PyDev module Food_utilities.py. The function is...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write and test the function by_origin( foods, origin) in the PyDev module Food_utilities.py. The function is described in the Food_utilities module. The function takes a list of Food objects, foods and an integer number representing a food origin, and creates a list containing only the foods of the given origin. Test it from t01.py. def by_origin (foods, origin): 11 11 11 Creates a list of foods by origin. foods is unchanged. Use: v=by_origin (foods, origin) Parameters: foods - a list of Food objects (list of Food) origin - a food origin (int) origins - Food objects from foods that are of a particular origin (list of Food) Returns: 11 11 11 To test the function you need to read the food.txt file into a list of Food objects. Then you need to repeatedly call by_origin, each time with the list of all the Food objects and one of the food origins. The following shows what we expect for the output. It should list each food origin followed by the foods having that origin. Write and test the function by_origin( foods, origin) in the PyDev module Food_utilities.py. The function is described in the Food_utilities module. The function takes a list of Food objects, foods and an integer number representing a food origin, and creates a list containing only the foods of the given origin. Test it from t01.py. def by_origin (foods, origin): 11 11 11 Creates a list of foods by origin. foods is unchanged. Use: v=by_origin (foods, origin) Parameters: foods - a list of Food objects (list of Food) origin - a food origin (int) origins - Food objects from foods that are of a particular origin (list of Food) Returns: 11 11 11 To test the function you need to read the food.txt file into a list of Food objects. Then you need to repeatedly call by_origin, each time with the list of all the Food objects and one of the food origins. The following shows what we expect for the output. It should list each food origin followed by the foods having that origin.
Expert Answer:
Answer rating: 100% (QA)
It seems like you want to create a Python function byorigin that takes a list of Food objects and an ... View the full answer
Related Book For
Business Statistics For Contemporary Decision Making
ISBN: 978-1119320890
9th edition
Authors: Ken Black
Posted Date:
Students also viewed these programming questions
-
Current Attempt in Progress Based on the following transactions, calculate the revenues and expenses that would be reported (a) on the cash basis and (b) on the accrual basis: a. Credit sales to...
-
Solve this in python. **[70 pts]** You will be writing code for recording the menuitems and daily sales of a lemonade stand. It will have theseclasses: MenuItem, SalesForDay, and LemonadeStand. All...
-
BONUS (5 points) You plan to retire at 65 and want an annuity that will pay you $3700 a month for 30 years from an account that pays 3.75% interest. How much needs to be in your account?
-
Grimm Company has 2,400,000 shares of common stock outstanding on December 31, 2014. An additional 150,000 shares of common stock were issued on July 1, 2015, and 300,000 more on October 1, 2015. On...
-
An Object at an Angle A 16.0-cm-long pencil is placed at a 45.0? angle, with its center 15.0 cm above the optic axis and 45.0 cm from a lens with a 20.0-cm focal length as shown in Fig. 34.65. (Note...
-
Determine the moment of inertia I x of the shaded area about the x axis. |-100 mm--100 mm150 mm 150 mm 150 mm 75 mm
-
Why is the executive summary an important part of the report?
-
Comparative data from the balance sheet of BlackBerry Limited are shown below. Instructions (a) Using horizontal analysis, calculate the percentage change between 2014 and 2015. (b) Using vertical...
-
Consider the recorded transactions below. Transaction Account Name Debit Credit 1. Accounts Receivable 7,400 Service Revenue 7,400 2. Supplies 1,800 Accounts Payable 1,800 3. Cash 9,200 Accounts...
-
Company Selection and Financial Retrieval: Pick a public company that piques your interest. Obtain its latest financial statements. 2. Cash Flow Interpretation: Using the acquired financial data,...
-
A measurement of ozone levels gives a value of 240 DU. How many ozone molecules would this represent in a column with a cross sectional area of 1 m, assuming P and 0C? Include your work.
-
An IV of 1200mL is scheduled to run to completion at a rate of 40gtt/min using a 20gtt/ml set. After 6 hours 640mL have infused. Calculate the new rate in gtt/min so that the iv completes on time
-
Julio bought tables and chairs for his restaurant. He bought 16 total items and spent $1800. Each table cost $150 and each chair cost $50. Let x represent the number of tables and y represent the...
-
carol has 18 fruits in a basket, 3 of them are apples, of them are pineapples and the rest are oranges, write down an expression in terms of for the number of oranges in the basket
-
jelle puts 1200 at the end of every year into Ira that averages 5% interest compounded annually. how much be be in the account when she retires after 35 years of investing
-
2 . I have 2 gold coins, each 1 oz and 18K. I melt them to make a gold chain for myself. What is the purity of the gold chain? What is the weight of the gold chain?
-
5. The mean number of arrivals per period in queuing theory is denoted by: A. " B. A C.0 D. T Use the following information to answer Questions 5-7 A single server waiting line system which is...
-
Explain five different cases of income exempt from tax with clear examples.
-
A dairy company in the Manufacturing database tests its quart milk container fills for volume in four-container samples. Shown here are the results of 10 such samples and the volume measurements in...
-
Use the random numbers in Table A.1 of Appendix A to select 10 of the companies from the 30 companies listed in Table 7.2. Compare the types of companies in your sample with the types in the...
-
Using the international unemployment database, construct a stem-and-leaf plot for Italy. What does the plot show about unemployment for Italy over the past 40 years? What does the plot fail to show?
-
A phenotypically abnormal individual has a phenotypically normal father with an inversion on one copy of chromosome 7 and a phenotypically normal mother without any changes in chromosome structure....
-
Explain why inversions and reciprocal translocations do not usually cause a phenotypic effect. Then explain how they can do so in certain cases.
-
A triploid plant has 18 chromosomes (i.e., 6 chromosomes per set). If we assume that a gamete has an equal probability of receiving one or two copies of each of the 6 types of chromosome, what are...
Study smarter with the SolutionInn App