Question: Problem 5 : Total World - wide Production Need Problem 5 a: So , now that we ve done all that work, how much seafood

Problem 5: Total World-wide Production Need
Problem 5a:
So, now that weve done all that work, how much seafood will the entire world need to produce 50 years from now?
For this problem, write a function called total_production_need(data, years_to_predict) that returns a single number: how many metric tonnes will the world need to produce years_to_predict years from now?
This function should do the following:
Take as input the data returned from Problem 1s parse_data and a number of years in the future to predict.
For each country code, predict the production need for years_to_predict years from now using Problem 4as predict_need function.
Get the last value in the predicted values.
For example, if you assign the return value from predict_need to prediction, you should be able to get the last value with prediction["values"][-1].
Sum up all of the predicted values.
Return the total.
Running your program with small.csv as the input file to parse_data, total_production_needshould return a total production need of 13243690.762868665.(Your degree of precision may vary.)
Problem 5b: Running with the large file:
At this point, its time to run with the larger data file. Change the call to parse_data to use "large.csv" as its input. Then, at the very end of your program, add a print statement to print out the total you return from total_production_need. Your program should print the following:
Metric tonnes of seafood needed to be produced in 50 years: 245,637,243.224
Info
You can format very large numbers using Pythons f-string syntax. For example, if total =245637243.223947, doing print(f'{total_need:,.3f}) would print 245,637,243.224.
Warning
This final number is a gross approximation and should not be used as a realistic estimate of the worlds total seafood production need.

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!