How many tries it takes to get code to work is a good measure of 1) the complexity of the problem and 2) how skilled you are at that language.
The more experience you have, the more you collect good habits which prevent doing something more than once. "If I do thing W it's likely to break thin X", or "Always do thing Y before thing Z," that kind of stuff.