Skip to content

Instantly share code, notes, and snippets.

@jobliz
Created January 8, 2013 23:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jobliz/4488869 to your computer and use it in GitHub Desktop.
Save jobliz/4488869 to your computer and use it in GitHub Desktop.
def profit(supply, demand, sale_price=0.40, production_cost=0.25, welfare_price=0.10, lost=0.15):
operative_cost = production_cost * supply
if supply >= demand:
excedent = supply - demand
sale_income = demand * sale_price
welfare_gain = excedent * welfare_price
result = sale_income + welfare_gain - operative_cost
else:
not_baked_loss = lost * (demand - supply)
sale_income = supply * sale_price
result = sale_income - operative_cost - not_baked_loss
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment