WARNING: Dodona is only used for submission and not for giving feeback. This means that after submission your code is compiled but not tested. Every last submission will be manually evaluated and considered as your final exam submission.
Define the following variables and lists at the beginning of your program:
country_name
gdp
: total GDP in EURpopulation
: total populationinflation_rates
: list of inflation rates (%) for different yearsunemployment_rates
: list of unemployment rates (%) for different yearsprices
: list of prices for a product for a number of daysYou can use as example Belgium:
gdp_per_capita
with as parameters gdp and population that returns
the GDP per capita.average_inflation
with as parameter inflation_rates that returns
the average of the inflation rates. The function should be independent of the number of
years for which data is available.inflation_trend
with as parameter the inflation_rates that counts the
number of increases and decreases year after year and returns
average_unemployment
, unemployement_trend
) for unemployment.price_statistics
with as parameters the prices of a product that returns
inflation_median
with as parameter the inflation rates that
returns the median inflation rate. You can use the Python’s built-in statistics module
to calculate the median.Define a function report
with as parameters:
This function uses the previously developed function to create the following report
========================================
Economic Report for Belgium
========================================
GDP per Capita: €50,775.86
Inflation:
- Average: 3.16%
- Median: 2.40%
- Trend: Falling
Unemployment:
- Average: 5.62%
- Trend: Stable
Price of Bread:
- Average: €2.47
- Highest: €2.53
- Lowest: €2.40
- Days Above Average: 3
========================================