Swimming is a great way to exercise and for legs, a slow, measured breast stroke is especially good as it works on all the major muscles in your legs.
But while you’re in the pool, you can exercise your legs easily and effectively in other ways. Here are two examples:
Grasp the edge at the side of the pool face-on. Stretching your legs out behind you, gently move each leg in turn up and down and then out to the side. Repeat this 10 - 15 times.
Many professional sportspeople use this technique to strengthen their leg muscles, as well as providing great aerobic exercise. Standing at the edge in the shallow end of the pool, walk across the width of the pool with your arms raised to your sides to balance you. Repeat this 10 times.