I didnʼt, and thatʼs probably the case with most coders my age (at least in my country).
When I got my first computer, I was amused by all the things it could do. Not just that I can play nice games on it, but that I can give it orders and it carries them out. It was awesome seeing my name on the TV screen after I typed PRINT "Hello Gergely". I wanted to learn it hard, but my mom said itʼs useless (computers werenʼt widespread at the time, so to say). Nevertheless, she signed be up for the schoolʼs computer faculty class (every Monday, after school), and I happily attended. I still remember “Kriszti néni" (literally “Miss Christina”; I canʼt recall her surname, even though she was my hero back then,) she taught us a lot about basic coding in, well, BASIC.
After that, however, I was on my own. We moved to a different city at the other end of the country, and my travel as a lonely programmer began. I did have a classmate who was interested in computers, but he liked using software much more than creating them (and heʼs became an aerodynamics expert since then).
In high school I became the sysadmin, as neither teachers could do it (why it was their job is beyond me). I was allowed to do it as long as I donʼt skip classes and my grades remain at least average. So I did; with some help, I built the network of that school, and I learned a lot. I created their homepage (first in Perl CGI then in PHP3), and I learned a lot. Then I graduated and I soon got my first job as a sysadmin, and I learned even more.
Since then, Iʼm so busy with my work I donʼt really think about having proper schooling on these subjects. With huge companies on my CV, no one ever asked me if I have grades.
=====
Now that I think back, I donʼt know if any mentors could help me more than I did myself. I have the power to be able to ask if I get stuck (unfortunately, many developers lack this skill), so I can get along pretty well. On the other hand, I know well this wouldnʼt work for anybody. I was a huge introvert back then, finding my first good friend around the age of 16.
The best thing anyone can do is to know themselves. If you know you can get along well alone, do it. If you think you need a teacher or mentor, do it. Itʼs all about you, so you can be a bit selfish this time.
Have fun coding!