Going back to the circuit we started with, you can see that the electrical power is calculated by multiplying together the current in the bulb and the voltage across it. In general:
powerwatt = voltagevolt × currentampere
Now, the voltage across bulb is 12 volt and the current in bulb is 2 ampere, so
power of bulb = 12 volt × 2 ampereand the power of the bulb is calculated as 24 watt.
Note that the power calculated here includes the total energy shifted by the bulb through lighting and through heating. The energy shifted by the electrical working pathway does not all end up being shifted by the lighting pathway. The bulb is not as efficient as we'd like. More on this can be found in the SPT: Energy topic.
An example to explore
Here is a simple loop, where you can choose the battery and choose the bulb, so setting the resistance of that bulb. These choices have consequences for the current in the loop and the power dissipated by the bulb and switched by the battery.
You may well find the code intelligible – the physics is only two lines:
voltageresistance = currentand
power = current × voltage
The rest is all concerned with display.