PROG0199 - Big Mac Index

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:

  • in Europe, a Big Mac costs €3.44
  • in the United States, a Big Mac costs $4.07
  • this means that the exchange rate can be calculated as €0.845 per dollar $\def\euro{\unicode{x20AC}}\def\dollar{\unicode{x0024}}\left(\frac{\euro 3.44}{\dollar 4.07} = 0.845\right)$
  • the actual exchange rate is €0.70 per dollar
  • the euro is overvalued by 20.7% with regard to the dollar $\left(\frac{0.845-0.70}{0.70}\times 100 = 20.7\% \right)$

The numbers in the example above are based on the Big Mac index 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.'

De Big Mac index is een methode waarmee wisselkoersen op een licht verteerbare manier kunnen geanalyseerd worden. Deze index werd in 1986 door Pam Woodall ontwikkeld voor de Amerikaanse krant The Economist. Sindsdien publiceert die krant elk jaar een geactualiseerde versie van de index. Deze index gaf ook aanleiding tot de term burgernomics.

Het principe werkt heel eenvoudig. De Big Mac wisselkoers tussen twee landen kan berekend worden door de prijs van een Big Mac in één land (in de lokale munteenheid van dat land) te delen door de prijs van een Big Mac in een ander land (opnieuw in de lokale munteenheid van dat land). Deze berekende wisselkoers wordt dan vergeleken met de reële wisselkoers op dat ogenblik. Indien deze lager uitvalt, dan is de eerste munt ondergewaardeerd ten opzichte van de tweede, anders is de eerste munt overgewaardeerd ten opzichte van de tweede. Dit wordt geïllustreerd aan de hand van volgend voorbeeld:

  • in Europa betaalt men €3.44 voor een Big Mac
  • in de Verenigde Staten betaalt men $4.07 voor een Big Mac
  • de wisselkoers kan dus berekend worden als €0.845 per dollar $\def\euro{\unicode{x20AC}}\def\dollar{\unicode{x0024}}\left(\frac{\euro 3.44}{\dollar 4.07} = 0.845\right)$
  • de reële wisselkoers bedraagt echter €0.70 per dollar
  • de euro is dus met 20.7% overgewaardeerd ten opzichte van de dollar $\left(\frac{0.845-0.70}{0.70}\times 100 = 20.7\% \right)$

De cijfers die gebruikt werden in bovenstaand voorbeeld zijn gebaseerd op de versie van de Big Mac index zoals die op 28 juli 2011 werd gepubliceerd door The Economist.

Opgave

  1. Schrijf een functie waardering die op basis van de Big Mac index een analyse maakt van de wisselkoers van een bepaald land ten opzichte van de dollar. Aan deze functie moeten twee argumenten meegegeven worden die als floating point getallen moeten beschouwd worden: i) de prijs van een Big Mac, en ii) de reële wisselkoers ten opzichte van de dollar. Bij de berekening van de Big Mac wisselkoers mag de functie uitgaan van een kostprijs van $\$4.07$ voor een Big Mac in de Verenigde Staten. Op basis van de procentuele verhoudig $v$ van de berekende dollarkoers ten opzichte van de reële dollarkoers, moet de functie een string teruggeven overeenkomstig onderstaande tabel.
    VERHOUDING (%) WAARDERING
    $v \leq ?25$ sterk ondergewaardeerd
    $?25 < v \leq ?5$ ondergewaardeerd
    $?5 < v \leq 5$ ongeveer gelijk
    $5 < v \leq 25$ overgewaardeerd
    $v > 25$ sterk overgewaardeerd
    Zo moet de functie voor een kostprijs van €3.44 voor een Big Mac in Europa en een reële dollarkoers van €0.70 per dollar, de string overgewaardeerd als resultaat teruggeven.
  2. Gebruik de functie waardering om een functie wisselkoersanalyse te schrijven. Aan deze functie moeten twee argumenten doorgeven worden: de kostprijs van een Big Mac en de wisselkoers van de dollar (in lokale munteenheid per dollar). De kostprijs moet doorgegeven worden als een string die zowel het bedrag als de lokale munteenheid vermeldt, van elkaar gescheiden door een komma: bijvoorbeeld "3.44 euro" of "2.39 pond sterling". Merk dus op dat de munteenheid zelf uit meerdere woorden kan bestaan. De functie wisselkoersanalyse moet een string teruggeven die de waardering van de lokale munt ten opzichte van de dollar omschrijft. Als formaat voor de beschrijving gebruik je de volgende template: "De euro is overgewaardeerd ten opzichte van de dollar.". De cursieve fragmenten van deze template zijn variabel, en moeten door de functie wisselkoersanalyse worden ingevuld op basis van de opgegeven naam van de munteenheid en de berekende waardering.

Voorbeeld

>>> waardering(3.44, 0.70)
'overgewaardeerd'
>>> wisselkoersanalyse('3.44 euro', 0.70)
'De euro is overgewaardeerd ten opzichte van de dollar.'

Added by:Peter Dawyndt
Date:2011-12-13
Time limit:5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:PY_NBC
Resource:None

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.