I am at secondary school right now and I'm the only one in my class who is experienced with programming. Because of that, people are constantly distracting me while I'm writing code to ask me to solve a problem. Usually I reply with something like 'I don't know, I never use that' but I don't want to lie to people.

Another problem is that I became so well known for this that even students from other classes are asking me questions. I find this damn annoying.

Thirdly, if I solve a problem for them they don't learn anything from it.

How can I stop people from asking me programming-related questions in a kind way? 

Wear headphones.  Common trick used by undergraduate TAs who needed to use the same computer labs as their students at my school.  They don't even need to be plugged into anything.  This won't discourage everyone, but should cut down on the numbers quite a bit.  

Post a sign on your textbooks / notebook, and put it in your email signature that you don't have time to answer questions due to your own intense studies.

Start a tutoring business, and explain that you charge X dollars an hour and schedule meetings ahead of time.  This won't end the problem entirely, but it will help people value your time and will give you some spending money.
