This resistor works on the principle of photo conductivity. It is nothing but, when the light falls on its surface, then the material conductivity increases.
A LED or Light Emitting Diode is a Semiconductor two terminal(Pin) component, the two terminals are (+)Positive and (-)Negative. The voltage is applied to positive terminal and negative terminal should be ground light is emitted. Here we are using 12V LED so the maximum Voltage for positive terminal is 12V and minimum is 3V. If we use anything above 12V the LED will get short circuit.
import RPi.GPIO as GPIO
In this screen you can see the status if its Day or Night, If it is night the LED will be ON.