计算毛利
毛利是指销售收入减去销售这些商品的成本(也称为已售商品成本,Cost of Goods Sold,COGS)。COGS 不包括行政或市场营销费用,只包含与生产或提供该商品或服务直接相关的成本。因此,毛利可以很好地衡量任一产品或服务的核心盈利能力。
\(Gross\,Profit = {Total\,SalesValue}-{Total\,COGS}\)
毛利率是将毛利表示为销售额百分比的指标,有助于分析与决策。
\(Gross\,Profit\,Margin = \frac{Gross\,Profit}{SalesValue}\)
作为一家工厂的经理,您被要求检查下一年的毛利预测。
本练习是课程的一部分
Python 金融预测
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Set the sales variable to 8000
sales = ____
# Set the cost of goods sold (cogs) variable to 5400
cogs = ____
# Calculate the gross profit (gross_profit)
____ = ____ - ____
# Print the gross profit
print("The gross profit is {}.".format(____))