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.

Part 1 – Storing Economic Data (2 points)

Define the following variables and lists at the beginning of your program:

You can use as example Belgium:

Part 2 - Define functions (8 points)

  1. Define a function gdp_per_capita with as parameters gdp and population that returns the GDP per capita.
  2. Define a function 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.
  3. Define a function inflation_trend with as parameter the inflation_rates that counts the number of increases and decreases year after year and returns
    • “Rising” if more increases
    • “Falling” if more decreases
    • “Stable” otherwise The function should be independent of the number of years for which data is available.
  4. Define similar functions (i.e. average_unemployment, unemployement_trend) for unemployment.
  5. Define a function price_statistics with as parameters the prices of a product that returns
    • Average price
    • Highest price
    • Lowest price
    • Number of days the price was above average
  6. Define a function 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.

Part 3: Generating an Economic Report (5 points)

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
========================================