The electromagnet needs to be ac.
Work Step by Step
If the light bulb is wired in series with wire loops, the magnetic field within the loops will always be changing. This induces a voltage that can light the bulb. If the electromagnet were dc, the magnetic field would not change, and no current would be induced.