Answer:
A generator converts mechanical energy into electrical energy. It contains a coil which spins between two magnets and generates electric current.
It is based on the Faraday's law of induction which states that as the magnetic flux linked with the coil changes, an emf is induced in the coil. Thus, when the coil spins between the magnets, the flux linked with it changes continuously and an emf is produced in the coil and current is produced.