开始使用免费开始使用

计算销售额

要做销售预测,既要知道我们计划的产品售价,也要知道预计能卖出多少件。在这个示例中,我们来看一家名为 T-Z 的公司生产并销售 T 恤。

该公司为客户提供两种选择——基础款和定制款。基础款 T 恤售价 15 USD,定制款售价 25 USD。

T-Z 预计下月将有 T 恤订单,并希望沿用相同的销售组合:60% 基础款、40% 定制款。由于该组合相对稳定,我们可以为 T-Z 计算每件产品的平均销售单价。变量 forecast_units 已为您设置。

本练习是课程的一部分

Python 金融预测

查看课程

练习说明

  • 将基础款销售单价设置为变量 salesprice_basic,定制款销售单价设置为变量 salesprice_custom
  • 根据销售组合计算 T 恤的平均销售单价。
  • 计算下月的预测销售额 sales_USD
  • 打印 USD 计的总销售额。

交互式实操练习

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

# Set variables units sold and sales price of the T-shirts (basic and custom)
____ = ____
salesprice_custom = ____

# Calculate the combined sales price taking into account the sales mix
average_sales_price = (____ * 0.6) + (____ * ____)

# Calculate the total sales for next month
sales_USD = ____ * ____

# Print the total sales
print("Next month's forecast sales figure is {:.2f} USD.".format(____))
编辑并运行代码