I used 20.29g of MgCO3 to find .24mol CO2 and that the Pressure of CO2 = 12.54 atm.
But was that wrong? Should I have used 15.9g of MgO to find .39 mol, which would then give you P = 20.77 atm.
In my opinion, neither.
You are told that the sample of MgCO
3 is impure, so you cannot tell how many moles of that you have, and so how many moles of CO
2 "should" be produced.
Similarly, the MgO is also impure, and so also cannot give you a mass of CO
2. So what does that leave? (I think you will need to assume that CO
2 is the only gas given off....)