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.


  • _netmon_netmon Level 99 Wizard Mod Posts: 878 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
  • 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/Enterprise/Collab Member Posts: 946 ■■■■■■■□□□
    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 MSIT InfoSec, CISSP, SSCP, GSEC, EnCE, C|EH, CySA+, PenTest+, CASP+, Security+ Surf City, USAAdmin Posts: 11,665 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!
  • marknathonmarknathon Member Posts: 2 ■■□□□□□□□□
    I think learning at your pace is more important. But learn regularly. Best master the basics so that your concepts are clear. Udemy is a great resource.
    However, in my view, practice is more important. After 1 month or so of learning the basics, you should start making some good projects. Here is a list for 2020 projects ideas for python beginners by FavTutor .This is an updated list for this year and these small projects will be the best challenge to become a coding ninja. 
  • JDMurrayJDMurray MSIT InfoSec, CISSP, SSCP, GSEC, EnCE, C|EH, CySA+, PenTest+, CASP+, Security+ Surf City, USAAdmin Posts: 11,665 Admin
    Both Pluralsight and O'Reilly Media have lots of learning-to-code resources as well.
  • itdeptitdept Registered Users Posts: 134 ■■■■□□□□□□
    You learn to code by doing. Picking up a a book on coding or playing the piano might be good for theory but the doing is where the real learning happens. FYI, I love to learn by reading but the doing is where the "magic" happens
  • srothmansrothman Member Posts: 39 ■■■□□□□□□□
    I started working through some "Coding with Mosh" videos. It's very basic, but it's small enough chunks to not be overwhelming, and there is nice continuity as you work through the modules. Highly recommended.
  • LonerVampLonerVamp OSCP, GCFA, GWAPT, CISSP, OSWP, AWS SA-A, AWS Security, Sec+, Linux+, CCNA Cyber Ops, CCSK Member Posts: 488 ■■■■■■■□□□
    The biggest suggestion on the best way to learn to code? To code.

    Find reasons to use your coding skills. Find projects or tasks or just small things to do and Google how to do them. Rename all your mp3 files to something else. Browse a web page using only Python. Submit a form!

    From my experience with many other IT folks, it's all about learning the basics, giving yourself a shot, and then FINDING PROJECTS. Maybe you have something at work that needs solving and you think that language will work.

    Another thing you can do is after following your course projects word for word, change something. Echo out all the variables to the screen. Add some comments. Add some better displays. Tweak the order. Make a function. Add input arguments rather than hardcoded variables.

    Security Engineer/Analyst/Geek, Red & Blue Teams
    OSCP, GCFA, GWAPT, CISSP, OSWP, AWS SA-A, AWS Security, Sec+, Linux+, CCNA Cyber Ops, CCSK
    2020 goals: AWS Security Specialty, maybe AWAE or SLAE, CISSP-ISSAP?
  • JoJoCal19JoJoCal19 California Kid Mod Posts: 2,821 Mod
    Agreed. Learning by doing, by having something you'd like to create, is the best. I've done that with scripting. I had a tedious and repetitive task that needed to be done at one job. I decided to learn PowerShell to automate it. Covered some basics and just did trial and error until I got a working script. 

    I'm at it again. At my new job, I'm looking to modernize an offering by creating a self service portal and a dashboard. Of course we have no access to dev resources. Well, time to learn JS (along with re-learning HTML and CSS since it's been forever), and a backend framework as well.
    Currently Working On: Python, OSCP Prep
    Next Up:​ OSCP
    Studying:​ Code Academy (Python), Bash Scripting, Virtual Hacking Lab Coursework
Sign In or Register to comment.