3 AnswersNew Answer
Instead of making error-free programs try to make a buggy program and then make it error free, and don't give up until you make it finish it. This will give you more practical approach towards programming.
Should practice. Then, after you practice you'll need to practice some more. After completing that, you have to do it again.... All in all, a proficient programmer is one who never stops practicing. You're not going to become proficient if you don't set time out of your day to practice consecutively. While you're practicing which includes, studying and doing projects, check out other's work. See how they went about solving the solution, compare and contrast. Read up on foreign topics that you never heard of. Best of all, find a way to IMPROVE YOUR LIFE through code. Whether it's a script that automates browsing the internet or whatever. Don't treat the experience as a chore and for God's sake, It's not a race! It's going to take time.
Practice and learn 90% of your time.