Code examples
You cannot compile a piece of paper. Even if your teacher looked through your papers he may not find all the compile errors. A computer does this, now and everytime. Seeing your program function will make you feel that you have achieved something. You can see that what you write works!
If the code is for a throw away purpose - learning concepts and the like - there might be some truth to hand writing. But it could just aswell be written on a computer, speeding up your writing.
Documentation
If you're a programmer you'll be sitting in front of the computer most of the time. If you're sharing a code snippet with your colleagues you're better off sending it through chat. It will also ease your mind, to see your code built/running before sending it.
It's too hard to update/share hand written documentation. It will probably be outdated once it is printed.
Overall
You would repeat yourself by writing code on paper, as it would have to be copied to the computer at some point - thus violating the DRY principle. You write code once, and read it many times.