How Long Does it Take to Learn to Code?

My standard answer when people ask me how long it will take for them to become competent enough to get a job.

By Zed A. Shaw

How Long Does it Take to Learn to Code?

This post is based on an email I sent to someone who asked this question:

How long does it takes to master python or at least be enough to get a job (entry level data analyst or data scientist)?

I wanted to turn this into a blog post because I get this question a lot, but also because I have something else to add to my reply. First, here's what I wrote in reply:

First, A Warning

The purpose of my courses is not to teach you everything you need to know to get a job. That's basically impossible for any one course to do. The purpose of my courses is to teach you all of the things that other courses assume you already know. Nearly every single programming course out there claims to be for "beginners" but is written as if every "beginner" has been coding since they were 12 years old and already knows 4 programming languages. That's why they do this:

print("Hello World")

Followed by the massive leap of:

age = 30
if age < 50:
    print("You're old.")

People who have never written code before can't make that leap, but most of these courses don't care because they're aimed at the college market where it's expected the student actually does know 4 languages.

So my answer is based on how long will it take you to learn all the things you need to then be able to learn anything else in programming. Typically this is enough to get a job depending on your background, but nobody can tell you that you'll get a job in X amount of time. I'm basing this on what I've seen other students pull off too. For example, I've got one student who studied with my Python and C book, got curious about making electronic circuits and is now going to get an Electrical Engineering degree. Others worked for a year or more before they found work, but many of them were able to create a lot of interesting things after only a few months.

Keep that in mind: I'm separating, "how long to get skilled enough to then learn other topics" from "how long to be good enough to get a job." The first is easy to say, the second depends on way too many factors to give an accurate number.

"Well, let's be realistic here…"

You don't have to "master" Python to get a job using python. Especially in data science. Vast numbers of programmers, even the ones working on Python, are totally incompetent but still make money with it.

Quick additional insert here: Keep in mind that the market right now is insanely tough. It's not like 4 years ago when companies were desperate to hire programmers. Now companies are desperate to fire programmers, so your ability to learn to code is separate from your ability to get a job. You could learn Python well enough to get a Junior position but still not find work because a veteran programmer with 30 years experience is using AI to wipe out all the junior positions at the company.

What you want to aim for is "competence", not mastery. Mastery is totally undefined and many people who are "perfectionists" have this distorted idea that if you can't be a master at something in 10 minutes then you can't do it at all. That's totally false. To learn anything worthwhile requires effort and time, and many, many, MANY professional programmers have spent weeks solving bugs caused by a single letter.

Competence is fairly easily measured by the simple test of:

If given a task in programming, can you complete it in a reasonable amount of time with minimal help from others.

In some environments it's alright to ask for help, but typically you should only ask for help after you're totally stumped or else people will be annoyed or think you're an idiot.

The way you get to this ability is to create a bunch of projects. You'd be better off making 365 little projects over a year than 1 giant project over the same year. At the same time, you should attempt at least one "significant" project as a side project, but mostly tons of little projects are the way to get better at making things. People only pay you for making things, or fixing things.

One trap people fall into with this (especially perfectionists) is they think they have to make a ton of "original ideas." That's absolute bollocks. Every single artist, programmer, musician, and writer got good by copying other people's ideas. That means you could get the same benefit out of making your own replicas of 100 other people's ideas. Want to get good at front-end design? Do hundreds of recreations of other websites. Want to get good at data science? Replicate hundreds of other people's analyses.

However, you also want to be able to make your own things, so the plan is to do "copy then extend." Make a replica of something, then extend it to be your own. Do that enough and you'll be able to make your own things (which will really just be copies because nothing is original).

However, the problem with "just make stuff" is you can't really make anything until you have at least a basic understanding of programming, so the advice is totally useless if you don't even know what a for-loop is. You've got to get to where you can mostly code OK then you start making a bunch of things.

That's the basic idea behind my two Python courses. First you do Learn Python the Hard Way, and honestly you should do the code for each exercise twice. Once by reading it and copying it verbatim, then try to do the exercise again from memory with only looking at the code to refresh your memory. Or instead from memory, try to make your own version of it from scratch.

Once you've got the hang of Python you move on to More Python which has tons of projects and all sorts of ideas. That book is more something you do while working on your own thing, and you don't have to do it in order. Just pick your topic and do it. I also highly recommend you get every other book or course you can find and type in all of the code manually to build your skill even further.

No, But Seriously How Long?

Time frame depends on your background. If you have a background in music, math, or speak more than one language then you can probably get through the first course in 1-3 months and start the 2nd one. If you have no background then maybe 3-6 months? But, everyone's different so if you're going slow then just accept it and take your time.

Programming is really weird. You'll try to learn it for MONTHS and nothing makes sense. You feel like you're just a loser who will never learn to code, then one day, you wake up, and it's like Neo in the Matrix except you say "I Know Python." I'm serious, and just keep this in mind while you're banging your head on it. One day it will click and you will understand it, but you have to keep struggling with it until it does.

Addendum

While this advice is a practical answer to the question, I think it's important to understand why someone is asking this and add on a few warnings. Typically I get this question because of a few possible reasons, so if you fit into one of these categories I have additional advice:

"I lost my job and need a job NOW!" If you don't have a background in math or engineering you will not learn Python quick enough to get a job quickly. Please, whatever you do, try to find work in anything else while you try to change careers and don't put all your hopes on the idea that you'll become a Python programmer in a weekend.

"I'm tired of what I do now, and want to switch to programming." Whatever you do, do not quit your current job. I don't care how much you hate your current job, keep working there because it will be incredibly hard to find work in today's market (as of 2024). This also applies to the previous person, but right now there's so many unemployed programmers who are better than you that finding work is going to be nearly impossible for a fresh new programmer. I believe currently there's a few million unemployed programmers you'd be competing with in the current job market.

Other than that, I'd say most people can learn to code if they can put the time in, and that mostly just requires motivation and an ability to find the time. The key is to understand that programming is something that takes time to stick. You'll not get it for a while, then suddenly you will, so trust the process and keep going.


More from Learn Code the Hard Way

Just Use MSYS2 You Say?

Debunking idiots on HackerNews who think a total beginner can just 'Use MSYS2' on Windows.

TechnologyPublished Jul 16, 2024

Solving the Worst Problem in Programming Education: Windows

I've created a set of install scripts for Windows that helps people install many different programming languages using standard tools.

TechnologyPublished Jul 11, 2024

Minimum Educational C++

I go through various style guides and attempt to extract the minimum C++ someone can learn to be functional on many code bases, and in your own code.

OpinionPublished Jun 1, 2024

How Long Does it Take to Learn to Code?

My standard answer when people ask me how long it will take for them to become competent enough to get a job.

OpinionPublished Jun 1, 2024