How to Learn Python From Scratch for Data Science (Or Anything Else)
There are about a million websites out there that promise to help you learn Python from scratch. But if you’ve ever tried to learn Python, you’ve probably noticed that it can be extr
emely difficult to get started, and even more difficult to make progress. You might have tried to learn to code before and given up, thinking that it’s just not something you’re good at.
If that sounds like you, we’ve got some good news: you absolutely can learn Python from scratch, with zero prior programming experience. And if you’ve tried and failed before, it probably wasn’t your fault.
There are three major reasons that new Python coders fall off the wagon and stop learning before they’ve made any significant progress.
Reason #1: Good Coders, Bad Teachers
Most learn-to-code resources are created by programmers who genuinely want to help other people learn. But unfortunately, being a good coder and being a good teacher don’t necessarily have much overlap. For experienced programmers who’ve been working with Python for years, it can be difficult to put themselves back into the shoes of a first-time learner.
The reality is that a lot of programming concepts are tough to wrap your head around if you’re encountering them for the first time. Consider, for example, the way that Python indexes data types like lists. If you come from a programming background, counting the first item in a list as item 0 makes perfect sense. But regular people count starting with one, not zero!
Of course there good reasons Python uses zero indexing. But programming is full of concepts like this. They make sense to experienced programmers, but they can come off as deeply unintuitive to people who are trying to learn programming from scratch.
Experienced programmers often have a tough time remembering and relating to these early struggles, so in the learning materials they create, they expect you to “just get it.” That works for some students, but it also frustrates and drives away plenty.
Most of us need good explanation, context, and practice before we can really master challenging new concepts. Many Python learning resources, including those that promise to help you “learn Python from scratch,” provide explanations that make total sense to people who are already trained to think like programmers, but that are difficult to parse for the rest of us. And that causes people to drop out.
Reason #2: Missing Motivation
Another reason people who start trying to learn Python from scratch often stop is because they’ve lost motivation. In traditional education, this is often considered a failure on the student’s part. At Dataquest, we consider this a teaching failure.
It’s very difficult to learn anything without sufficient motivation. One of the strongest motivators is actually being able to use the skills you’re learning. This is where a lot of Python learning resources fail. They task you with learning syntax through rote exercises, or building pointless programs that have nothing to do with the reason you’re looking to learn Python.
It’s easy to fall off the wagon and stop studying if you started because you want to learn Python for data science but you’re not actually working with data as you learn.
Reason #3: ‘Learning’ But Not Applying
Applying what you’re learning is absolutely critical to long-term retention. Study after study has proven that.
That matters because many students attempt to learn Python from scratch using popular resources like books or video lectures. While these resources are often excellent, they can’t force you to apply what you’re learning. And even if you do set aside some time to write your own code after, for example, reading a chapter from a textbook, there’s no way for the book to provide you any feedback, or let you know when you’ve gotten something wrong.
That’s not to say you shouldn’t learn from books or videos — both can be invaluable resources! But if you’re not careful, they can also trick you into feeling like you understand a concept when you really don’t. It may only be days or weeks later, when you go to write your own code, that you realize you didn’t grasp things as well as you thought.
There’s a lot to learn in Python, but you don’t need to know everything to do meaningful work.
The Solution: How to Learn Python From Scratch
If you want to maximize your chances of successfully learning Python, it stands to reason that you need to take an approach that helps you avoid these three pitfalls. You don’t just want to learn Python, you want to learn Python the right way.
The first step is figuring out why you want to learn Python. Everything else flows from this, and the approach you take will vary depending on whether you want to learn Python for data science or for robotics or for game development or for something else!
The second step is to learn the basic syntax of Python. The important word there is basic. You don’t need to learn everything, and you shouldn’t. Learning syntax is necessary, but it can be kind of boring, and you want to minimize the amount of time you spend doing it. Your aim should be to learn the bare minimum you need to start working on projects that matter to you.
You can make this step a little easier if you can find learning resources that are tailored to the reason you want to learn Python. If you want to learn Python for data science, for example, our beginner and intermediate Python courses, both free, will teach you all the syntax you’ll need to get started building data science projects from scratch while tasking you to work with real-world data, which makes the process of learning syntax more engaging to people interested in learning data skills.
The third step is to build structured projects. Finding a tutorial to follow along with can be a good approach. Students interested in data science can try some of our guided projects, which are designed to encourage experimentation and creativity while still providing structure and guidance.
This article has a lot of other resources for finding structured project ideas across a variety of programming disciplines including game development, robotics, etc. For example, if you want to build mobile apps, this Kivy tutorial is a great first project. If you want to make games, check out these Pygame tutorials. The key is to start working as soon as possible on projects that genuinely interest you.
The fourth step is to build unique projects of increasing complexity as you continue to develop your abilities. After working through a few guided projects, you’ll likely have some ideas of your own you’d like to try. Go for it, even if you don’t think you have all the skills you need to be successful. You’ll learn these new skills along the way, as you need them.
They key is to break each project down into small, manageable chunks. For example, let’s say you want to analyze sentiment on Twitter. That’s an intimidatingly large project, but you can break it down into smaller tasks and approach learning them one by one. First, you’ll probably need to learn how to access and use Twitter’s API. Once you’ve figured that out, move on to learning how to filter and store the tweets you want to analyze. Then, you can move on to cleaning the data, and after that you can look into methods for sentiment analysis.
You can take a similar approach with projects of all sorts. You don’t need to know everything about how to do a project to start one! Break the project down into parts and learn part-by-part as you go.
You’ll spend a lot of time searching Google, StackOverflow, and Python’s official documentation, and that’s OK! One of the not-so-secret industry secrets about programming is that even the pros spend a lot of time Googling issues.
The fifth step is really just to continue step four, but add difficulty with each project you take on. If you already know at the outset how to implement every part of a project, that’s a good sign that it’s probably too easy for you and you won’t learn much from it.
The key is to keep things challenging, but not impossible. If you’re trying to learn to make games in Python, and you’ve already built a simple game like Snake, your next project shouldn’t be an immersive open-world 3D RPG. That’s adding too much difficulty too soon. But it should be building a game that’s a little more complicated than Snake.
Where to Learn Python
Obviously, there are lots of places where you can learn basic Python coding skills, and we encourage students to seek out whatever resources work best for them. If you’re interested in learning Python for data science, Dataquest has some unique advantages you may not find elsewhere:
The Dataquest platform in a nutshell.
- Unique platform with a hands-on learning focus. We want to get you working with code and experimenting with each new concept as quickly as possible. You’ll never go more than a minute or two without having the chance to apply something you’re learning, and with our platform, you can write and check Python code right in the browser window.
- Easily searchable, text-based content. Videos can be fun, but if you have to watch a 30 minute video before you get the chance to apply anything you’ve learned, you’re going to waste lots of time scanning back through the video trying to find the right moments to review concepts you’ve already forgotten. Dataquest’s text-based learning content more accurately reflects the reality of working as a data scientist (where you’ll often need to consult written documentation) and it’s incredibly easy to search through previous lessons and find what you want.
- Real-world data and interesting projects. It’s difficult to feel inspired to learn if you’re working with boring, fake data on projects that don’t mean anything. That’s why we use real-world data to answer real-world questions, and help you build projects you can use in your data science portfolio when you’re applying for jobs.
If you want to learn Python from scratch for data science, we think
our free introductory Python course is the ideal place to start.
If you’re looking to learn Python for other reasons, you’ll want to look for learning resources that are specific to your goals.
If you can’t find any, general “learn Python” resources will work, too —just remember to get into building projects and working on the things that motivate you as quickly as possible. Ultimately, that’s what will keep you going and ensure that you really do become of the the new coders out there who can genuinely claim that you learned Python from scratch.