Final answer:
Current flowing through wire loops within a magnetic field generates torque, causing the loops to rotate, thus converting electrical energy into mechanical work. If a bar magnet moves through a wire loop, a current is induced due to the changing magnetic field.
Step-by-step explanation:
When current is passed through wire loops within a magnetic field, the interaction of the current with the magnetic field exerts a torque on the loops. This interaction causes the loops, and hence the attached shaft, to rotate. This is the fundamental principle behind electric motors, where electrical energy is converted into mechanical work. As the loop rotates, to maintain continuous motion, the current is reversed every half rotation to ensure the torque is always directed in the same way, facilitating constant rotation.