Get startedGet started for free

Build a sensitivity analysis for the net profit

Txs Tools has provided the following forecast admin cost in USD based on full-time employees:

Jul = 1500 Aug = 1500 Sep = 1500

Build the forecast net profit forecast_net_profit when emp_leave = [6, 6, 0] and the cost per temp employee is 80 USD.

In addition to emp_leave and admin_usd, forecast gross profit has already been provided for you as forecast_gross_profit.

This exercise is part of the course

Financial Forecasting in Python

View Course

Exercise instructions

  • Create an index variable and initialize this index to 0.
  • Create the dependency by looping through the admin_usd list, using your index to access the correct month in your lists.
    • Set the number of temporary employees (temp) by referencing your emp_leave list at the current index
    • If there are temporary employees, your admin dependencies (admin_dep) should reflect the additional cost of the temporary employees (plus the standard admin costs)
    • Else, admin_dep should reflect the standard admin costs.
  • Calculate forecast_net_profit as forecast_gross_profit (at the index) minus the calculated admin_dep.
  • Print the forecast_net_profit.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

admin_usd = [1500, 1500, 1500]
emp_leave = [6, 6, 0]
forecast_gross_profit = [4850, 2800, 4600]
index = ____

for admin in admin_usd:
    temp = ____[index]
    if temp > 0:
        admin_dep = ____ * 80 + admin
    else: 
         admin_dep = ____ 
    forecast_net_profit = forecast_gross_profit[____] - ____
    print(forecast_net_profit)
    index += 1
print("The forecast net profit is:")
Edit and Run Code