Theory:

Different kinds of magnets were produced from magnetic materials in different shapes by magnetisation. An artificial magnet can be made
  • by electrically magnetising iron or steel alloys.
  • by striking a magnetic material with some other artificial magnets or magnetite.
magpngpng.png
Artificial magnets
 
These artificial or man-made magnets are classified as permanent or temporary magnets based on their ability to maintain magnetic properties.
Temporary Magnets:
By applying a magnetic field externally, temporary magnets can be produced. The magnetic property of a temporary magnets is not so strong, and hence they lose it easily once their magnetic field is removed.
 
These temporary magnets are generally made of soft iron. So, when exposed to an external magnetic field generated by a current-carrying coil of wire, the soft iron acts like a magnet. When the current in the circuit is turned off, it loses its magnetic properties.
Electromagnets:
When the current flows through the circuit, the coil behaves like a magnet. At the same time, the coil loses its magnetism when the current is turned off. These types of coils are known as electromagnets. It is a temporary magnet in which an electric current produces a magnetic field.
A small experiment to show the process of electromagnetism requires an iron nail, an insulated wire, few pins, and a cell.

shutterstock_1586415382.svg
Electromagnet
  1. Take an iron nail and a flexible plastic wire (or any insulated wire) of a certain length.
  2. Wound the wire tightly around the iron nail like a coil.
  3. Now, connect the ends of the wire to the cell and place the pins near the end of the nail.
  4. When the current is switched on, the pins clung to the tip of the nail.
  5. But when the current is turned off, the pins do not stick to the tip of the nail.
This phenomena shows that the flow of current enables the magnetic effect on the iron nail.
Example:
The electric bell works on the electric current passed through the coil, which makes the bell ring.
 
DoorBell_001.jpg
Electric bell
 
In a junkyard, a crane attached to an electromagnet is used to carry heavy metal loads. It also helps to separate magnetic materials from the junk.
 
shutterstock_1651414597.jpg
Junkyard crane
Reference:
https://upload.wikimedia.org/wikipedia/commons/c/c1/DoorBell_001.jpg