Python is supposed to be one of the easiest programming languages to learn. Knowing that made me feel pretty bad the first time I tried and failed to learn it. It was even worse the second time I failed.

But it turns out — and I learned this on the third try — that Python can be really accessible, even to a humanities-loving non-coder like me. You just have to approach it in the right way.

How I failed at learning Python… the first time

The first time I tried to learn Python was almost a decade ago. I wasn’t really sure what I wanted to do with it — maybe automate some of my work, maybe write a little app. It just seemed like a skill that would be good to know.

So I picked up a copy of the then-free Learn Python the Hard Way PDF and started trying to work through it.

The first wall I hit was getting Python set up on my own system. Especially at that time, most of the instructions on how to do that were written for experienced programmers, and it took me forever to slog through it all.

I wanted to learn how to write Python code, and my first step was to spend five hours fighting with the command line? I was demotivated before I even started.

Once I finally got things set up, I could write code along with the book. And I did, for a while, slowing piecing together a very simple text adventure game.

But when I hit the first real challenge — those moments that always come in coding where something doesn’t work and you just can’t figure out why — I quit.

I had more important things to do than pound my head against the keyboard and puzzle through inscrutable error messages. Especially when my end goal was making a text adventure game that I didn’t care about, and that no one would ever play.

How I failed at learning Python… the second time

A few years later, I tried again. By then I was working as a journalist, and I had become interested in data journalism, and web scraping in particular.

I knew that having Python coding skills would be necessary, so I found an online education platform — I won’t say which one — and started a beginning Python course.

Like most MOOCs, this course was video-based. I would watch a lecture about a Python-related topic, answer a quiz on the course site to confirm that I’d learned the material, and then move on to the next module.

Experienced programmers can probably already guess what happened next: when I went to try to write Python code for myself, I couldn’t do a thing.

Watching someone else code in videos and listening to their explanations, I had thought that I was learning how to do it for myself. And the multiple-choice and fill-in-the-blank quizzes I was getting 100% on seemed to confirm I had grasped the material.

But of course, when it came time to apply it on my own, I couldn’t. I could scan back through the videos and copy what the lecturer did, but I had a really hard time applying anything I’d learned to my own projects.

It was also hard to stay motivated, because I was working on things that didn’t seem relevant.

I wanted to learn web scraping. But instead I was struggling to understand video lectures about the concept of object-oriented programming (OOP). What did any of this have to do with my goals? I wasn’t sure, and that made it easy to quit. Again.

Why I failed

In retrospect, it’s not too difficult to figure out why I failed. The first time, my big mistakes were:

  1. Not having a clear goal. Why was I learning Python? I didn’t really know. That makes it really easy to quit when the going gets tough — which it always will, sooner or later.
  2. Too much of a challenge up front. Sooner or later, I’d have to figure out how to get Python onto my system, but setting this up with zero relevant experience, before I’d written as much as a print(‘Hello world!’) was a recipe for frustration and failure.

When you’re learning something challenging, especially as a total beginner, you need early wins to help you believe that you can really do it.

Starting with a frustrating challenge that didn’t even involve coding ensured that I didn’t get those motivating and affirming early wins.

The second time, I avoided those mistakes, but instead I made some new ones:

  1. I wasn’t learning by doing. Watching videos and passing quizzes was making me feel like I could code, but I wasn’t actually coding. When I did try (and fail) to write code, it was even more frustrating because I thought I already understood it. And because I had to do a bunch of clicking around in each video to rewatch different sections and relearn things.
  2. I had a clear goal, but not a clear path towards it. I knew I wanted to do data journalism and web scraping, but I was taking a generic beginning Python course. That meant I was learning lessons that might have been critical for software development but weren’t as relevant to data journalism. I often had a hard time connecting the fundamentals I was learning in class with what I actually wanted to be doing with the code.

Throughout it all, I was also making another big mental mistake. I was thinking about learning Python in very black-and-white terms. Either I had “learned Python” — all of Python — or I had not.

This made the prospect of learning really intimidating. Whenever I hit a challenge, it was made worse by the fact that I was thinking about some mythical Python “finish line” that was still very, very far away.

That’s misguided, of course. Like a spoken language, Python (and other programming languages) are not something you ever really finish learning. And like a spoken language, you don’t actually need to be fluent in Python to get things done.

As any first-year exchange student will tell you, just being able to ask “How much is this?” and “Where’s the bathroom?” in the local language can really affect your quality of life.

The same is true for Python. You don’t need to know everything — or even all that much, necessarily — to make a real difference in your own life.

But that’s a lesson that I only learned by accident.

How I actually learned (some) Python

By 2018, I had given up on learning Python. I had tried twice and failed twice! But then I got hired at Dataquest, a company that teaches data science skills — including Python programming — online.

My new job didn’t require any coding skill, but I figured I still needed to give the learning platform a try. I needed to understand our product, and what our learners felt were experiencing. Maybe, I thought, I could even learn enough to do some web scraping, like I had planned to before.

So, with some trepidation, I created an account and started our Python for Data Science course path.

To my surprise, it felt fun and easy. And to my greater surprise, it didn’t take long at all before I felt like I could build some projects on my own.

I wrote a little script to sort emails. I used Python to quickly analyze some survey data. And, in fits and starts, I built the big web scraping and analysis project I was dreaming of back when I was a journalist.

I was — and still am — actually using Python to facilitate my work, and improve my life. A couple of years later, I’m still a novice coder, but I can hack together little scripts to make things easier and solve data analysis problems I have at work using Python.

This happened because, more by chance than by design, I had stumbled across a way of learning Python that avoided almost all of the mistakes I’d made with my earlier efforts:

  • I came in with a clear goal — learn enough Python to be able to do a little data work so I could better understand our customers.
  • I avoided the up-front challenge of installing Python entirely, because Dataquest lets you learn and write code right in a browser window.
  • I was learning to code by actually coding rather than watching someone else code.
  • I was learning on a path that was designed for Python data work specifically, so everything that I was learning and every exercise I did felt relevant.
  • I was just trying to learn what I needed, not trying to learn all of Python.

How to make learning Python easier

Looking back at my mistakes, and then my accidental success, I think it boils down to a few simple takeaways:

First, go in with a goal. Why do you want to learn Python? What, specifically, do you want to build with it? If you don’t have a good answer for this question, it’s going to be really hard to stay motivated.

Second, find a way to learn by doing the thing you actually want to do. If you can find a targeted learning resource, like a platform that teaches Python specifically for game dev, that’s great. But general learning resources can work too as long as you’re applying what you learn with some beginner Python projects as you study.

Your learning to code has to include actually writing code, and it has to be actually writing code that does something you are interested in.

Third, avoid the up-front challenge of getting Python and its various libraries set up on your local system.

There are plenty of online platforms now that let you write and run code in a web browser, or you can write and run code in a notebook on Google Colab or a similar platform. Just try to make getting started as easy on yourself as possible. You can worry about your local setup later.

Fourth, don’t try to “learn Python.” That’s a massive long-term goal that’s arguably kind of unattainable — even the best Python devs don’t know literally everything about it.

Instead try to learn how to use Python to build a simple version of your goal project, or one part of that project. Then, learn how to use Python to make that project bigger, or how to move on to the next step.

Break big tasks down into smaller chunks, and focus your goals on building something so that you get the psychological reward of having built something when you complete one.

Follow these guidelines regardless of your personal reason for learning Python and I have no doubt you’ll be able to reach your goals without having to fail and quit twice along the way!