LDR code problems

for(k = 0; k < 10; k++){
light = light + analogRead(lightPin);
delay(2.5);
if(k = 9){
float lux = light / 10;
Serial.print("Light Intensity = ");
Serial.print(lux);
Serial.println(" lux");
light = 0;
}
}

This is the code I wrote for an LDR, where I basically add the analog values of the LDR 10 times and assign it to the light variable. Then, I created a conditional statement where if the loop is looping for its last time, then the average of the light variable (summation of the analog values of the LDR 10 times) would be assigned to the lux variable. This small loop is actually a part of a bigger loop with other smaller loops for other sensors.

However, when the entire loop ends and the average is printed, the light variable does not reset to 0, and every time the bigger loop (which loop through are the sensors) runs again, the light variable keeps on increasing and so does the value of the lux variable. I tried to make the light variable back to zero at the end of the conditional statement but it doesn't work. What do I do to reset the light variable to zero once the value of the lux variable is printed (so that the summation of the light variable can start from zero again?

  if(k = 9){Oops.

Please remember to use code tags when posting code

delay(2.5);

The delay() function takes an integer (actually an unsigned long) as its parameter