A sample of magnesium weighs 10 grams. How many moles of magnesium are there in the sample?

0.4 moles?

Yes and no. Yes, the 4 part looks ok but you have 10 g which looks like 2 places to me; therefore, I would round my answer to 1 place. 0.40 or 0.41 or whatever is what I would use.

we have to have the right number of sig figs so wouldnt 0.4 be the right answer in terms of sig figs

It depends upon how you look at the 10. Ten, written, as 10,(without the comma of course) technically has only one place so your answer would be 0.4 and you are correct. If we really mean for 10 to have two s.f. we should write it as 10 followed by a period (10.) or in scientific notation as 1.0E1. Either of those ways (10. or 1.OE1) shows it as two places with no quarrel. So if the 10 means 1E1, and from your comment I assume it does, then yes, the answer of 0.4 is correct. Many of the posts here get done in a hurry and students write 10 and mean 10. so I never really know from reading the problem exactly what it means in terms of s.f.

To determine the number of moles of magnesium in the sample, we can use the formula:

Number of moles = Mass of substance / molar mass of substance

The molar mass of magnesium is approximately 24.31 grams/mole.

So, in this case, we have:
Number of moles = 10 grams / 24.31 grams/mole

Calculating this gives us:
Number of moles = 0.411 moles

Therefore, there are approximately 0.411 moles of magnesium in the sample.