You are correct that the speed of light can vary depending on the medium through which it travels. When we refer to the "speed of light" as a constant, we are specifically referring to the speed of light in a vacuum, denoted by the symbol 'c'. In a vacuum, light travels at a constant speed of approximately 299,792,458 meters per second.
In different mediums, such as air, water, or glass, light does travel at different speeds. This is because the interaction between light and matter in these mediums can cause a slowdown of light. The speed of light in a medium is generally denoted by 'v' and is less than the speed of light in a vacuum (c).
The speed of light in a medium is determined by the refractive index of that medium, which describes how much the speed of light is reduced when it passes through the medium compared to its speed in a vacuum. The refractive index is a property of the medium and depends on factors like its composition and density.
So, when we talk about the speed of light as a constant, we are specifically referring to its speed in a vacuum. In different mediums, the speed of light is different, but the constant 'c' represents the maximum speed at which any form of energy or information can travel through space.