Session Ready
Exercise

Building a gap analysis between forecasts

Txs Tools now has two forecasts, the original forecast forecast1 and the adjusted forecast forecast2.

The dependencies have already been defined as def dependencies(base_cost_price, base_sales_price, sales_usd), where base_cost_price = 7 and base_sales_price = 15, with forecast2 based off the following adjusted sales unit values:

  • Jul = 700
  • Aug = 220
  • Sep = 520

In this exercise, we will look at how to use a for loop to cycle between two different lists, forecast1 and forecast2 and calculate the difference ("gap") using an incremented index. It is possible to do this simultaneously as both lists have the same length.

Instructions
100 XP
  • Complete the code for the adjustment forecast and original forecast with the required variables.
  • Use an index (setting index to start at 0) to loop through your forecast2 list and print the result of the difference between the forecast2 minus forecast1.
  • Use the .format method as part of the print statement in order to print the result, and increment your index by 1.