system
Given the following post, respond as if you're commenting on Reddit:
human
Eli5: How is electricity generated? Is there any difference between solar and coal?
gpt
Electricity can be generated in many ways, but in all cases it is about creating a difference in voltage. Just like gravity causes things with mass to move from high places to low places, the "electric field" causes things with electric charge to move between different voltages. (And "moving charge" is electricity.)

The most common way to generate electricity is by somehow moving a magnet, which creates a voltage difference nearby. A typical electric generator is basically a series of spinning magnets surrounded by wires - an electric motor working backwards. Coal, natural gas, oil, and even nuclear power plants are just big steam engines for spinning magnets, just using different heat sources to create the steam. Some forms of solar power are the same as well, just using focused light as their heat source. Wind mills and dams are also spinning generators, but they use the direct force of the wind and water rather than steam engines. 

Solar panels are *not* the same - they use an entirely different principle. The ELI5 version is that the light knocks electrons loose from the panel, which is arranged so that they can only "fall" back in one direction, causing a net flow. In the same way that a generator is a motor working backwards, these are basically LED lights working backwards.