The US Department of Agriculture (USDA) categorizes eggs by weight. The followin
ID: 3909517 • Letter: T
Question
The US Department of Agriculture (USDA) categorizes eggs by weight. The following table shows the classifcation scheme:
% Grade
Min. Weight (oz)
Small
1.5
Medium
1.75
Large
2
Extra large
2.25
Jumbo
2.5
Note that eggs weighing less than 1.5oz do not fall into any category. Write a function named classify_eggs that accepts a list containing the weight of each egg and returns a dictionary of egg classifications. Here is an example:
In [1]: egg_weights = [1.21, 1.82, 1.9, 1.31, 2.45, 2.2, 1.4, 2.74, 2.99, 2.38]
In [2]: classify_eggs(egg_weights)
Out[2]: {'Extra Large': 2, 'Jumbo': 2, 'Large': 1, 'Medium': 2}
% Grade
Min. Weight (oz)
Small
1.5
Medium
1.75
Large
2
Extra large
2.25
Jumbo
2.5
Explanation / Answer
def classify_eggs(egg_weights): d = {} for weight in egg_weights: if 1.5Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.