We have to clarify that a lightning is an electric discharge from the earth's atmosphere, the contains 2 factors
the ray which is the light that is generated
and thunder is sound.
The sound has a speed of 340m / s then
340 meters / seconds. how many seconds does it take to 4000 meters /? seconds
4000/340 = 11.76 seconds
I hope it help you