What is the best way to learn to code?

GlldyaGlldya CliftonPosts: 1Member ■□□□□□□□□□
I'm teaching myself to program in Python and I've hit a bit of a snag. I'm using a course on Udemy and it covers quite a lot; variables, if elif and else statements, while and for loops, booleans, lists dictionaries and tuples, functions, and object oriented programming. However, I've found that it's very, very difficult to take the lessons I've learned on the course and apply them more generally to other problems. The instructions are very specific to each exercise. The instructor will say "Give variable X this value, then give variable Y that value, then use a while loop, etc..." all the way through until the project is completed. The end result is that I've learned to complete that specific project, but only by following the instructions like a recipe. Ask me to complete a different project using the same techniques and I'm stuck, even if the second project is objectively easier than the first one.

It's getting very frustrating, especially since I don't currently have the money to pay for a real course and am basically stuck with teaching myself. What, in your experience, is the most effective way for a novice coder to learn the principles of coding so as to best expedite his ability to use code to solve different problems? Thanks in advance.


  • Skyliinez92Skyliinez92 Level 99 Wizard Posts: 767Mod Mod
    Take a look at https://www.codecademy.com/
    There are 10 types of people in this world; those who understand binary and those who don't.
  • Infosec_SamInfosec_Sam Posts: 107Admin Admin
    I think codecademy is a great resource as well, but it sounds like you have a different problem than you think you have. It sounds like you do know the fundamentals of programming (variables, conditionals, loops, etc.), but your problem is not knowing how to bring them together to make a project. This might be because you're scoping your projects too wide right now. Here's a link that includes 5 mini-projects for Python that are geared towards a beginner. This is the scope that you want to focus on while you build your skills, just single-function projects for right now. Once you feel confident in that, try to think of single functions you could add to your functions. Maybe you want to add a GUI to the random number guesser, so you can learn how Python interacts with HTML, or you want to see how to link to a database (Warning: Databases are hard and they suck, but they're super useful). It's all about incremental addition.

    As far as additional learning goes, you should look into object-oriented programming. It's not Python-specific, but Python is an OO language. This will involve learning things like inheritance, abstraction, encapsulation, and polymorphism. Remember to pace yourself, and understand that it will take a while to progress. 
  • paul78paul78 Posts: 2,934Member ■■■■■■■■■■
    My personal opinion is that you ought to figure out some problem that you want to solve with a software solution. I.e. build a website to host a forum, build a calendar scheduler, recreate tetris, etc. Working to create an actual working application imo is the best way to learn how to program or to learn a programming language. That's what I did and it works well for me. If you are like most learners - hands-on experience and actual problem solving is usually the best experience to get. And with the abundance of resources on the internet - it's actually a very practical way to learn.

    Good luck in your journey!

  • rsxwithslicksrsxwithslicks Member Posts: 73Member ■■■□□□□□□□
    I'm trying to learn myself and something that seems to come up a lot is don't get in a loop of just doing tutorials. It can create a false sense that you actually didn't learn anything. Try and build things, whatever they may be, to figure out how they work and are written. As paul78 mentioned.. Hands-on experience and actual problem solving is the best experience to get.
  • MontagueVandervortMontagueVandervort Senior Member Posts: 368Member ■■■■■□□□□□
    Having different books and applying what I learn from the books towards projects is what always worked for me.

    Getting stuck in "Tutorial Land" just leaves you going around in circles.

    To fully learn/understand you have to come up against things that you need to build/solve/fix and then learn ways to make them work.

    That's the way it to get it all to "stick" in your mind.
Sign In or Register to comment.