Step 1: Definition of molarity.
Molarity is defined as the number of moles of solute per litre of solution.
Step 2: Effect of temperature.
Volume of solution changes with temperature due to thermal expansion or contraction, which directly affects molarity.
Step 3: Analyse other options. Nature of solute: Does not affect molarity directly. Mass of solvent: Relevant for molality, not molarity. Molar mass of solvent: Has no effect on molarity.
Step 4: Conclusion.
Temperature is the factor that affects molarity of a solution.