What is the best way to learn to code?

GlldyaGlldya noneCliftonMember Posts: 1 ■□□□□□□□□□
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 Mod Posts: 861 Mod
    Take a look at https://www.codecademy.com/
    2020 goals: Server 2016 MCSA/MCSE (70-740, 70-741, 70-742, 70-744), Powershell training
    2021 goals: RHCSA/RHCE, AWS, Python training

    Train people well enough so they can leave, treat them well enough so they don't want to. - Richard Branson
  • Infosec_SamInfosec_Sam Security+, CCENT, ITIL Foundation, A+ Madison, WIAdmin Posts: 438 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. 
    Community Manager at Infosec!
    Who we are | What we do
  • paul78paul78 Member Posts: 3,016 ■■■■■■■■■■
    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 Member Posts: 75 ■■■□□□□□□□
    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 Member Posts: 399 ■■■■■□□□□□
    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.
  • thomas_thomas_ CompTIA N+/S+/L+; CCNA R&S; CCNP R&S Member Posts: 923 ■■■■■■□□□□
    Find something you want to automate and then work to automate it.  When you run into problems research them on the internet.  You'll slowly start learning things and it starts to make a little more sense.  You'll start to remember how to do things without looking them up and you'll eventually get to where you are doing more advanced things.
  • JDMurrayJDMurray Certification Invigilator Surf City, USAAdmin Posts: 11,534 Admin
    The book Automate the Boring Stuff with Python is good for beginner Python projects. The HumbleBundle book deal occasionally has Python books.
  • RoksanaRoksana Member Posts: 2 ■■□□□□□□□□
    Thank you, this question was also relevant to me! Thanks for the cool information!
Sign In or Register to comment.