$\pu{10 mol}$ of an ideal gas confined to a volume of $\pu{10 L}$ is released into atmosphere at $\pu{300 K}$ where the pressure is $\pu{1 bar}.$ The work done by the gas is:
Work done can be found as
$$W = -p_\mathrm{ext}(V_\mathrm{f} - V_\mathrm{i}).\tag{1}$$
$$V_\mathrm{f} = \frac{nRT}{p} = \frac{\pu{10 mol}\times\pu{0.083 L bar K^-1 mol^-1}\times\pu{300 K}}{\pu{1 bar}} = \pu{249 L}\tag{2},$$
$$W = -\pu{1 bar}\cdot(\pu{249 L} - \pu{10 L}) = \pu{-239 bar L}\tag{3}$$
As the question is asking us to find the work done by the gas, so shouldn't it be $\pu{+239 bar L},$ as work done by the gas is negative of the word done by external pressure?
But someone told me that the work done calculated is the work done by the gas and $\pu{-239 bar L}$ should be the answer. So, what mistake am I making and how do I determine if work done by the gas (and external pressure) is positive or negative under different conditions (expansion and compression)?
P.S.$\pu{-239 bar L}$ is the answer according to the answer key.