Answer:
Every electric current produces magnetism. ... Since the compass needle is also a magnet, the magnetic field around the wire attracted and repelled the ends of the compass magnet and caused it to move. You have seen that electricity flowing through a wire can cause a magnet to move. This is called the motor effect