I am trying to make a electro magnet. I bought a coil of enamel copper wire from Ebay. How do I determine its resistance?
And the diameter is .5mm


I'd look it up on google and find a table like this: -



Your diameter of 0.5 mm lies somewhere between 24 and 25 AWG and this means a 100 metre length will have about 9 ohms.


  Now, my question is how accurate is the result?


It will vary with temperature - hotter means higher resistance. At 20 degC copper has a resistivity of 1.68E-8 ohm-metres so using your formula I get a 0.5mm diameter wire of 100 metre length to be 8.57 ohms.

But it also depends on impurities in the copper: -



Only the "pure copper" trace aligns with the calculations above because there are no impurities. Now I'm not saying your vendor has added any nickel into the alloy but if you do eventually get an ohm meter and measure it, this might be an explanation.

Above picture taken from here.