It is quite simple.
The number of moles will equal to the weight, divided by the atomic mass (Usually multiplied by 2, becuase of bonding) Like O2, F2, Cl2 etc.
So, 1 gram of fluorine will equal to (19x2) (F2), which will be 38.
Then, 1 (gram) / 38 = 0.026315 moles of fluorine