The Big Mac index is a method used for easily analyzing exchange rates. This index was developed in 1986 by Pam Woodall for the American paper The Economist. Since then, the paper publishes an updated version of the index yearly. This index was the base for the term burgernomics.

The principle is simple. The Big Mac exchange rate between two countries can be calculated by dividing the price of a Big Mac in one country (in the monetary unit of that country) by the price of a Big Mac in another country (again in the monetary unit of that country). The exchange rate calculated is then compared with the actual current exchange rate. If it is lower, the first monetary unit is undervalued with regard to the second. Otherwise, the first monetary unit is overvalued with regard to the second. This is illustrated in the example below:

The numbers in the example above are based on the Big Mac index1 that was published 28 July 2011 in The Economist.

Assignment

  1. Write a function appreciation that makes an analysis of the exchange rate of a certain country in relation to the dollar based on the Big Mac index. To this function, 2 arguments must be passed that need to be seen as floating point numbers: i) the price of a Big Mac, and ii) the actual exchange rate with regard to the dollar. On calculating the Big Mac exchange rate, the function may assume $4.07 as the price of a Big Mac in the United States. Based on the relation in terms of percentage $$v$$ of the calculated dollar rate with regard to the actual dollar rate, the function should give a string corresponding the table below.

    RELATION(%) APPRECIATION
    $$v \leq -25$$ strongly underrated
    $$-25 < v \leq ?5$$ underrated
    $$-5 < v \leq 5$$ about equal
    $$5 < v \leq 25$$ overrated
    $$v > 25$$ strongly overrated

    The function should give the string overrated for a Big Mac price of €3.44 in Europe and an actual dollar rate of €0.70 per dollar.

  2. Use the function appreciation to write the function exchange_rate_analysis. Two arguments should be given to this function: the price of a Big Mac and the exchange rate of the dollar (in the local monetary unit per dollar). The price should be put in as a string that states both the amount and the monetary unit, separated from each other by a comma: for example "3.44 euros" or "2.39 pound sterling". Note that the monetary unit can consist of more than one word. The function exchange_rate_analysis should give a string describing the appreciation of the monetary unit with regard to the dollar. Use the following template:

    The euro is overrated with regard to the dollar.

    The fragments in italics in this template are variable and need to be filled out by the function exchange_rate_analysis based on the name of the monetary unit and the calculated appreciation.

Example

>>> appreciation(3.44, 0.70)
'overrated'
>>> exchange_rate_analysis('3.44 euro', 0.70)
'The euro is overrated with regard to the dollar.'