The relative atomic mass of the element is 39 (it's potassium, FWIW).

3.9 g of X reacts with 0.8 g of oxygen (since 4.7 - 3.9 = 0.8)

Get rid of the decimal points by multiplying by 10 on each side.

This means that 39 g of X reacts with 8 g of oxygen.

Handily enough, the atomic mass of oxygen is 16, which is 8 x 2.

Therefore to react with 16 g (one mole) of oxygen, you need 78 g of X.

For every one mole of oxygen you're using two moles of X so one mole of X weighs 39 g.

The relative atomic mass of X is 39.