It is fairly easy to build an electromagnet. All you need to do is wrap some insulated copper wire around an iron core. If you attach a battery to the wire, an electric current will begin to flow and the iron core will become magnetized. When the battery is disconnected, the iron core will lose its magnetism.