I'm probably being too abrasive, but this isn't anecdotal. Half the kids at school just aren't that bright and they just don't even really need to be.
You don't need to be all that bright to program, though. That's the larger point I'm trying to make. Programmers, of course, enjoy making it sound like what they do is wizardry, but it really isn't.
As for why there aren't many women programming... beats me. It's seriously not as if they are actively or even passively discouraged.
Maybe that's how it is in the UK, but certainly not in the US. There is no good reason why there aren't more women in STEM fields other than that they are enculturated to avoid "male" things like that. And most of the people currently in STEM fields don't do a great job of making women (or minorities) feel welcome when they do enter into those types of jobs. The misogyny of Silicon Valley is pretty well-known at this point. Just one portion of the industry, but a high-profile one, and I think fairly representative of the whole.