开始使用免费开始使用

为净利润构建敏感性分析

Txs Tools 提供了基于全职员工的以下行政成本(USD):

Jul = 1500 Aug = 1500 Sep = 1500

emp_leave = [6, 6, 0] 且每位临时员工成本为 80 USD 时,构建预测净利润 forecast_net_profit

emp_leaveadmin_usd 外,预测毛利润已作为 forecast_gross_profit 提供给您。

本练习是课程的一部分

Python 金融预测

查看课程

练习说明

  • 创建一个 index 变量,并将其初始化为 0。
  • 通过遍历 admin_usd 列表来创建依赖关系,使用 index 访问列表中对应月份。
    • 通过引用当前 index 处的 emp_leave 列表,设置临时员工的「人数」(temp)
    • 如果有临时员工,您的行政依赖项(admin_dep)应体现临时员工的额外成本(加上标准行政成本)
    • 否则,admin_dep 仅体现标准行政成本。
  • forecast_net_profit 计算为 forecast_gross_profit(在 index 位置)减去计算得到的 admin_dep
  • 打印 forecast_net_profit

交互式实操练习

通过完成这段示例代码来试试这个练习。

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:")
编辑并运行代码