# Python Fundamentals

Kindly check this problem:
A grocery store sells a bag of ice for \$1.25 and makes a 20% profit. If it sells 500 bags of ice, how much total profit does it make?

Has it been formulated correctly? The profit, can it be computed on selling price.

Well, profit, in terms of currency can be expressed like this:
`Profit = SellPrice - CostPrice`
We donâ€™t know `CostPrice`, but we know the profit percentage (equation according to this):
`ProfitPerc = Profit / CostPrice`

So, moving around the equation a bit:

``````ProfitPerc = (SellPrice - CostPrice) / CostPrice
ProfitPerc * CostPrice + CostPrice = SellPrice
(1 + ProfitPerc) * CostPrice = SellPrice
CostPrice = SellPrice / (1 + ProfitPerc)
``````

Substituting the values we know gives us the `CostPrice` which probably is the correct value (just remember to use percentages as fractions).

Now you just use the first equation and it should give how much total profit they got.

### Why probably?

Because it makes so much nicer result if you assume that the `CostPrice` is `SellPrice * 0.8` (100% - 20%), which gives nice 1\$. So it really depends on how the person describing the problem understood it.

### TL;DR

Depends on how the problem-giver understood this problem.