If I have 40mg of potassium, that would be how many moles of potassium?

mols= grams/atomic number

0.04g/39.0983= .001023062
would equal 1.02 x 10^-3 correct?
Did I do this problem correctly?

Yes it is done correctly but if you have 40 mg that is only two sig figures (and then only if it is written as 40.); therefore, you would be allowed only two in the final answer. You have 3 s.f. in 1.02E-3.

Yes, you did the problem correctly.

To determine the number of moles of potassium, you divide the given mass (in grams) of potassium by the atomic mass (or atomic weight) of potassium. The atomic mass of potassium (K) is approximately 39.0983 g/mol.

In this case, you have 0.04 grams of potassium, so you divide that by the atomic mass of potassium:

0.04 g / 39.0983 g/mol ≈ 0.001023062 moles

Your answer is correct to three decimal places, so the number of moles of potassium is approximately 0.00102 moles or 1.02 x 10^-3 moles.