You are the architect of an all-new boxing tournament and you intend to experiment with a...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
You are the architect of an all-new boxing tournament and you intend to experiment with a new weight categorization system that encourages healthy training practices. To beat the old pen-and-paper tournaments, you would have to use your superior programming skills to write a function that uses the data of the athletes to categorize them. Write a function WeightClass that takes a list of dictionaries weightList as a parameter and returns a dictionary of weight categories for each boxer. The input follows the following format: 1. Input is a list of dictionaries 2. Each dictionary contains 3 keys: Name, 0 and 1 3. 0 corresponds to a list of weights measured during the off-season and 1 corresponds to a list of weights measured during the tournament season An example of the input is given below: weightList [ { "Name": "Sugar Ray", 0: [158,167,173, 170], 1: [159, 157, 145,149]}, {"Name": "Ali", 0: [220, 231,218,204], 1: [198,194, 209, 216]},. .] The function WeightClass evaluates the category using the following criteria: The average weights for off-season and in-season are computed by averaging over their respective lists . Weighted average is measured using the above averages with a weight of 0.7 and 0.3 assigned to in-season and off-season averages respectively. weighted Average = 0.7xinSeason Average + 0.3xoff Season Average = The weighted average is then used to categorize the boxer into their weight class as follows weighted average 200: Heavyweight ("H") 150 weighted average < 200 : Middleweight ("M) weighted average < 150: Lightweight ("L") Returns a dictionaries with the names of the boxers as keys and their weight class indicated with the letter as the values def WeightClass (weightList): Parameters: weightList (list) Return value: dictionary with names and weight classes indicated with the letters Important notes: Comments: your program should have a header and comments that explain the solution steps. main function: write the appropriate code to test the functions you implemented. This part will not be graded. (Do not use input statements) Remember to add the main call at the end of the program as follows: "1 main ": if name main () Save your file as lab12.py and upload it to Vocareum Examples Input/Output: Sample Input: [ { "Name": "Sugar Ray", 0: [158,167,173, 170], 1: [159,157,145, 149]}, {"Name": "Ali", 0: [220, 231,218,204], 1: [198, 194,209,216]}, {"Name":"Pacquiao", 0: [153, 151, 148,140], 1: [147, 145, 144, 145]}] Sample Output: {'Sugar Ray': 'M', 'Ali': 'H' 'Pacquiao': 'L'} You are the architect of an all-new boxing tournament and you intend to experiment with a new weight categorization system that encourages healthy training practices. To beat the old pen-and-paper tournaments, you would have to use your superior programming skills to write a function that uses the data of the athletes to categorize them. Write a function WeightClass that takes a list of dictionaries weightList as a parameter and returns a dictionary of weight categories for each boxer. The input follows the following format: 1. Input is a list of dictionaries 2. Each dictionary contains 3 keys: Name, 0 and 1 3. 0 corresponds to a list of weights measured during the off-season and 1 corresponds to a list of weights measured during the tournament season An example of the input is given below: weightList [ { "Name": "Sugar Ray", 0: [158,167,173, 170], 1: [159, 157, 145,149]}, {"Name": "Ali", 0: [220, 231,218,204], 1: [198,194, 209, 216]},. .] The function WeightClass evaluates the category using the following criteria: The average weights for off-season and in-season are computed by averaging over their respective lists . Weighted average is measured using the above averages with a weight of 0.7 and 0.3 assigned to in-season and off-season averages respectively. weighted Average = 0.7xinSeason Average + 0.3xoff Season Average = The weighted average is then used to categorize the boxer into their weight class as follows weighted average 200: Heavyweight ("H") 150 weighted average < 200 : Middleweight ("M) weighted average < 150: Lightweight ("L") Returns a dictionaries with the names of the boxers as keys and their weight class indicated with the letter as the values def WeightClass (weightList): Parameters: weightList (list) Return value: dictionary with names and weight classes indicated with the letters Important notes: Comments: your program should have a header and comments that explain the solution steps. main function: write the appropriate code to test the functions you implemented. This part will not be graded. (Do not use input statements) Remember to add the main call at the end of the program as follows: "1 main ": if name main () Save your file as lab12.py and upload it to Vocareum Examples Input/Output: Sample Input: [ { "Name": "Sugar Ray", 0: [158,167,173, 170], 1: [159,157,145, 149]}, {"Name": "Ali", 0: [220, 231,218,204], 1: [198, 194,209,216]}, {"Name":"Pacquiao", 0: [153, 151, 148,140], 1: [147, 145, 144, 145]}] Sample Output: {'Sugar Ray': 'M', 'Ali': 'H' 'Pacquiao': 'L'}
Expert Answer:
Answer rating: 100% (QA)
1 Define the function WeightClass that takes a list of dictionaries weightList as a parameter python ... View the full answer
Related Book For
Software Architecture In Practice
ISBN: 9780136886020
4th Edition
Authors: Len Bass, Paul Clements, Rick Kazman
Posted Date:
Students also viewed these programming questions
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
7 8 0 The following data is provided for the Piedmont Corporation. All costs are actual costs. Complete the cost flows diagram attached to this problem and calculate CGM and CGS. Prepare journal...
-
Consider the following hypothesis test: H0: u u is less than or equal to 50 Ha: u > 50 A sample of 60 is used and the population standard deviation is 8. Use the critical value approach to state your...
-
In 1990 the average and median prices of a new single-family home were approximately $95,200 and $118,200, respectively. Ten years later, these prices had risen to $139,000 and $177,000. During the...
-
The study of thermodynamics enables us to understand (a) Whether the transformation of energy is feasible or not (b) To what extent the transformation will take place (c) In which direction the...
-
Southland Industries has $60,000 of 16% (annual interest) bonds outstanding, 1,500 shares of preferred stock paying an annual dividend of $5 per share, and 4,000 shares of common stock outstanding....
-
During June, Danby Company's material purchases amounted to 6,600 pounds at a price of $7.90 per pound. Actual costs incurred in the production of 2,300 units were as follows: Direct labor: Direct...
-
AnderSet Laboratories produces rough lenses that will ultimately be ground into precision lenses for use in laboratory equipment. The company has developed the following thickness measures, based on...
-
Kingbird Corporation began operations on January 1, 2022. During its first 3 years of operations, Kingbird reported net income and declared dividends as follows. Dividends Net income declared 2022...
-
What is a partial regression coefficient? How do we measure it?
-
Mention some situations in which two-stage cluster sampling should be used.
-
Compare the ways the regression coefficients are interpreted in simple regression and in multiple regression.
-
Explain how a price-weighted stock index must be adjusted to reflect the stock split of a company.
-
How are simple and multiple regression similar? How are they different?
-
Classify the following PDE u- 2uy +uyy +, 0 a. Elliptic b. Hyperbolic c. Parabolic d. Nonhomogeneous e. Linear
-
Write a set of concrete scenarios for security for an automobile. Consider in particular how you would specify scenarios regarding control of the vehicle.
-
Research a costly system failure that could be attributed to one or more poor architectural decisions. Do you think an architecture evaluation might have caught the risks? If so, compare the cost of...
-
Write a concrete performance scenario that describes the average on-time flight arrival performance for an airline.
-
__________ is the special systems test that determines the time duration to process transaction data. (a) Peak load testing (b) Performance time testing (c) Unit testing (d) Recovery testing
-
The testing technique that requires devising test cases to exercise the internal logic of a software module is called ___________. (a) Black box testing (b) Special systems testing (c) Glass box...
-
Systems efficiency is defined as ___________. (a) Doing the thing in right way (b) Doing right thing (c) Doing right thing in right way (d) Any of these
Study smarter with the SolutionInn App