Question
Question: Objective: Given the budget.csv file, read the date into a two-level nested dictionary. Calcula... Use Python Objective: Use Python Given the budget.csv file, read
Question: Objective: Given the budget.csv file, read the date into a two-level nested dictionary. Calcula... Use Python
Objective: Use Python
Given the budget.csv file, read the date into a two-level nested dictionary. Calculate and write the mean of each row and each column to a new file named resuit.txt.
Example Dialog:
For this data:
year 1 year 2 year 3
person 1 651000 651000 651000
person 2 1100500 950100 340000
person 3 740000 780000 800000
The value of the dictionary should look like this:
{'person 1': {'year 1': 651000, 'year 2': 651000, 'year 3': 651000}, 'person 2': {'year 1': 110500, 'year 2': 950100, 'year 3':340000}, 'person 3': {'year 1': 740000, 'year 2': 780000, 'year 3': 800000 }}
The content of 'resuit.txt should be:
The average of year1 is 830500.00
The average of year2 is 793700.00
The average of year3 is 597000.00
The average of person1 is 651000.00
The average of person2 is 796800.67
The average of person3 is 773333.33
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started