Question: A function to produce analysis. write and display all the analysis in a new CSV file ( analysis . txt ) , as in the

A function to produce analysis. write and display all the analysis in a new CSV file (analysis.txt), as in the sample below. These analyses include:
average number of defects found per product type. use the following formula:
Average Defects per Product Type =(Total Defects for Product Type)/(Total Production Entries for Product Type)
a- calculate_average_defects_per_product_type and return a list of tuples containing the product type and its average defect count. As an example, the function should return [('Product A',5.7),('Product B',4.4),('Product C',6.2)]. Ensure that the function handles cases where a product type has no defects, returning a zero average for that product type
b- write the result in analysis.txt file (as below)
analyze the distribution of environmental impact categories in the provided dataset and display the percentages for each category.
To calculate the percentage of production entries falling into each environmental impact category (low:CO2<30, medium: 30<=CO2<55, high: CO2>=55), use the following formula:
Percentage of a category =(Number of entries in that category / Total number of
entries)*100
Count the number of machines with maintenance status as "Done" and "Not done".

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!