Python Introduction - Session 1 Exercises

ISEG Executive Education - PG AAIML

Author

Diogo Silva

Tips:

Each exercise lists the course units it practises. Exercises named Investment analyst build on each other around the same problem, from session 1 to session 3.

Session 1: U0 – U3

In class: Exercise 1 (Exercise 2 if there is time).

Unit Recommended
U2 Variables, I/O and data types 1, 2
U3 Making decisions 1, 2

Exercise 1: Investment analyst – investment over 3 years

Units: U2, U3

  • You are an analyst working for a large investment corporation.
  • Your task is to analyze the evolution of investments over time and provide insights to clients.
  • For this exercise, you will receive (input) the amount of initial investment value.
  • For each year, your forecaster colleague will give you (input) the predicted return.
  • You will calculate the investment value for each year, over a period of 3 years.
  • You will also determine if the investment has increased or decreased compared to the previous year, for each year.

Exercise 2: Investment analyst – political influence

Units: U2, U3

  • An election is coming up, and your clients are concerned about the potential impact of different political parties on their investments.
  • You need to factor in the influence of political parties on the investment returns.
  • The client will provide you with the initial investment value.
  • Your colleague, the forecaster, has provided you with the base annual return rate.
  • You have also partnered with a political analyst who has provided you with:
    • the impact factors of different political parties on the annual return rate - this value should be summed to the base annual return rate.
    • a prediction of which party will be in power in each year;
  • Your task is to calculate the investment value for each year, considering the influence of political parties, and determine, for each year, if the investment will increased or decreased compared to the previous year.