How to learn Python

Written by Admin

Why Should You Learn Python?

Python is one of the most popular and in-demand programming languages in the world, and it’s here to stay.

But what’s the best way to learn Python?

That can be difficult and painful to figure out. Unfortunately, I know this from experience.

A little over a decade ago, I was just a college graduate with a history degree. I then became a machine learning engineer, data science consultant, and now CEO of Dataquest.

If I could do everything over, I would follow the steps I’m going to share with you in this article. It would have fast-tracked my career, saved me thousands of hours, and prevented a lot of stress.

Let’s get started.

Is Python Really That Difficult?

When I was learning, I found most of the Python courses and resources were too generic.

Right away, I wanted to learn how to make websites using Python. But the Python learning resource wanted me to spend months on syntax before they got into what interested me.

This barrier felt intimidating and daunting. I put it off for months. Whenever I started a Python course, I quickly lost interest. Python code continued to look foreign and confusing:

from django.http import HttpResponse
def index(request):
    return HttpResponse("Hello, world. You're at the polls index.")

For example, the code above is from the tutorial for Django, a popular Python website development framework. Experienced programmers will often throw snippets like the above at you, “It’s easy!”, they’ll promise.

However, to some beginners, this code might as well be an alien language.

Most Python tutorials assume that you need to learn all of Python syntax before you can start doing anything interesting. But that’s boring! Instead, you probably want to be analyzing data, or building a website, or creating an autonomous drone with artificial intelligence.

All that time spent on syntax saps your motivation, and most people give up.

I like to think of this as the “cliff of boring”. You need to be able to climb the “cliff of boring” to make it to the “land of interesting stuff you work on” (better name pending).

But you don’t have to spend months on that cliff.

learning python should not feel like this

Learning Python syntax doesn’t have to feel like this.

Learning Python Doesn’t Have to be Painful

After many failed attempts, I found a process that worked better for me. In fact, I think this is the best way to learn Python programming.

First, I spent as little time as possible memorizing Python syntax.

Then, I took what I learned and immediately dove headfirst into a project I actually found interesting.

Following this process is not only much more fun, but it allows you to learn at an incredible rate.

Step 1: Figure Out What Motivates You to Learn Python

Before you start, it’s worth asking yourself why you want to learn Python programming.

At times, your learning experience will be boring and monotonous. To successfully make it through those stages, you need to anchor yourself by focusing on things you’re highly interested in.

As a beginner, I struggled to keep myself awake when trying to memorize syntax. However, when I needed to apply Python fundamentals to build a website to automatically score essays, I happily stayed up nights to finish it.

To get started, find one or two areas that interest you. Some projects that you might find interesting are:

  • Data science / Machine learning
  • Mobile apps
  • Websites
  • Computer science
  • Games
  • Data processing and analysis
  • Hardware / Sensors / Robots
  • Scripts to automate your work

Yes, you can make robots using the Python programming language! From the Raspberry Pi Cookbook.

Step 2: Learn the Basic Syntax

Unfortunately, this step can’t be skipped. But you can spend the minimum amount of time on this, as it isn’t very motivating.

Here are some good resources to help you learn the Python basics:

I can’t emphasize this enough: Only spend the minimum amount of time possible on syntax.

The sooner you can get to work on projects, the faster you will learn. You can always refer back to the syntax when you get stuck later. Ideally, you will spend a couple of weeks on this phase, but no more than a month.

Quick note: Learn Python 3, not Python 2. Unfortunately a lot of “learn Python” resources online still teach Python 2, but you should definitely learn Python 3. Python 2 is no longer supported, so bugs and security holes will not be fixed!

Step 3: Make Structured Projects

Once you’ve learned the basic Python syntax, start doing projects on your own. Until you apply your knowledge, it will be hard to remember everything you’ve learned.

Projects will stretch your capabilities, help you learn new Python concepts, and it will help you build a portfolio to showcase your abilities to potential employers.

It’s better to begin with structured projects until you feel comfortable enough to make projects on your own. Here at Dataquest, virtually all of our Python courses contain structured projects to help you apply what you’ve learned.

Some additional recommended resources for structured projects are:

Data science / Machine learning

  • Dataquest — Teaches you Python and data science interactively. You analyze a series of interesting datasets ranging from CIA documents to NBA player stats. You eventually build complex algorithms, including neural networks and decision trees.
  • Python for Data Analysis — written by the author of a major Python data analysis library, it’s a good introduction to analyzing data in Python.
  • Scikit-learn documentation — Scikit-learn is the main Python machine learning library. It has some great documentation and tutorials.
  • CS109 — this is a Harvard class that teaches Python for data science. They have some of their projects and other materials online.

Mobile Apps

  • Kivy guide — Kivy is a tool that lets you make mobile apps with Python. They have a guide on how to get started.

Websites

Games

An example of a game you can make with Pygame. This is Barbie Seahorse Adventures 1.0, by Phil Hassey.

Hardware / Sensors / Robots

Scripts to Automate Your Work

Once you’ve done a few structured projects in your own area, you should be able to move into working on your own projects. But, before you do, it’s important to spend some time learning how to solve problems.

Step 4: Work on Python Projects on Your Own

After you’ve worked through a few structured projects, you will learn Python faster if you can start to work on your own projects on things you find interesting.

Remember to start with a small project, though. It’s better to start a small project that you finish rather than a huge project that never gets done.

Sometimes it can feel daunting to find a good Python project to work on. Here are some tips to finding some interesting projects:

  • Extend the projects you were working on previously, and add more functionality.
  • Check out our list of Python projects for beginners.
  • Go to Python meetups in your area, and find people who are working on interesting projects.
  • Find open source packages to contribute to.
  • See if any local nonprofits are looking for volunteer developers.
  • Find projects other people have made, and see if you can extend or adapt them. Github is a good place to find these.
  • Browse through other people’s blog posts to find interesting project ideas.
  • Think of tools that would make your every day life easier, and build them.

Some additional ideas to spark your imagination:

Data Science / Machine Learning Project Ideas

  • A map that visualizes election polling by state.
  • An algorithm that predicts the weather where you live.
  • A tool that predicts the stock market.
  • An algorithm that automatically summarizes news articles.

You could make a more interactive version of this map. From RealClearPolitics.

Mobile App Project Ideas

  • An app to track how far you walk every day.
  • An app that sends you weather notifications.
  • A realtime location-based chat.

Website Project Ideas

  • A site that helps you plan your weekly meals.
  • A site that allows users to review video games.
  • A notetaking platform.

Python Game Project Ideas

  • A location-based mobile game, where you capture territory.
  • A game where you program to solve puzzles.

Hardware / Sensors / Robots Project Ideas

  • Sensors that monitor your home temperature and let you monitor your house remotely.
  • A smarter alarm clock.
  • A self-driving robot that detects obstacles.

Work Automation Project Ideas

  • A script to automate data entry.
  • A tool to scrape data from the web.

My first project on my own was adapting my automated essay scoring algorithm from R to Python. It didn’t end up looking pretty, but it gave me a sense of accomplishment and started me on the road to building my skills.

The key is to pick something and do it. If you get too hung up on picking the perfect project, there’s a risk that you’ll never make one.

As you build your project, you will encounter problems and errors with your code — it’s inevitable. Don’t let it discourage you. There are a number of resources that can help you, including:

  • StackOverflow — a community question and answer site where people discuss programming issues. You can find Python-specific questions here.
  • Google — the most commonly used tool of every experienced programmer. Very useful when trying to resolve errors. Here’s an example.
  • Python documentation — a good place to find reference material on Python.

Step 5: Keep working on harder projects

Keep increasing the difficulty and scope of your projects. If you’re completely comfortable with what you’re building, it means it’s time to try something harder.

Continue to find new projects that challenge your skills and push you to grow even more.

Here are some ideas for when that time comes:

  • Try teaching a novice how to build a project you made.
  • Can you scale up your tool? Can it work with more data, or can it handle more traffic?
  • Can you make your program run faster?
  • Can you make your tool useful for more people?
  • How would you commercialize what you’ve made?

Going forward

At the end of the day, Python is continually evolving. There are only a few people who can legitimately claim to completely understand Python, because they created it.

You’ll constantly be learning and working on new projects to hone your skill. If you do this right, you’ll find yourself looking back on your code from 6 months ago and thinking about how terrible it is. If you get to this point, you’re on the right track.

Python is a fun and rewarding language. I think that anyone can reach a high level of proficiency if they find the right motivation.

I hope this guide has been useful on your journey. If you have any other resources to suggest, please let us know!

Find out more about how you can learn Python and add this skill to your portfolio by visiting Dataquest.

Common Python Questions:

Is it hard to learn Python?

Learning Python can certainly be challenging, and you’re likely to have frustrating moments. Staying motivated to keep learning is one of the biggest challenges.

However, if you take the step-by-step approach I’ve outlined here, you should find that it’s easy to power through because you’ll be working on projects that genuinely interest you.

Can you learn Python for free?

There are lots of free Python learning resources out there — just here at Dataquest, we have dozens of free Python tutorials and our interactive data science learning platform, which teaches Python, is free to sign up for and includes many free lessons. The internet is full of free Python learning resources!

The downside to learning for free is that to learn what you want, you’ll probably need to patch together a bunch of different free resources. You’ll spend extra time researching what you need to learn next, and then finding free resources that teach it. Platforms that cost money may offer better teaching methods (like the interactive, in-browser coding Dataquest offers), and they also save you the time of having to find and build your own curriculum.

Can you learn Python from scratch (with no coding experience)?

Yes. At Dataquest, we’ve had many learners start with no coding experience and go on to get jobs as data analysts, data scientists, and data engineers. Python is a great language for programming beginners to learn, and you don’t need any prior experience with code to pick it up.

How long does it take to learn Python?

Learning a programming language is a bit like learning a spoken language — you’re never really done, because programming languages evolve and there’s always more to learn! However, you can get to a point of being able to write simple-but-functional Python code pretty quickly.

How long it takes to get to job-ready depends on your goals, the job you’re looking for, and how much time you can dedicate to study. But for some context, Dataquest learners we surveyed in 2020 reported reaching their learning goals in less than a year — many in less than six months — with less than ten hours of study per week.

How can I learn Python faster?

Unfortunately, there aren’t really any secret shortcuts! People are always looking for the ultimate Python crash course, but it doesn’t really exist. The best thing you can do is find a platform that teaches Python (or build a curriculum for yourself) specifically for the skill you want to learn (for example, Python for game dev, or Python for data science).

This should ensure that you’re not wasting any time learning things you won’t actually need for your day-to-day Python work. But make no mistake, whatever you want to do with Python, it’ll take some time to learn!

Do you need a Python certification to find work?

We’ve written about Python certificates in depth, but the short answer is: probably not. Different companies and industries have different standards, but in data science, certificates don’t carry much weight. Employers care about the skills you have — being able to show them a GitHub full of great Python code is much more important than being able to show them a certificate.

Should you learn Python 2 or 3?

We’ve written about Python 2 or Python 3 as well, but the short answer is this: learn Python 3. A few years ago, this was still a topic of debate, and some extreme predictions even claimed that Python 3 would “kill Python.” That hasn’t happened, and today, Python 3 is everywhere.

Is Python a good language to learn in 2021?

Yes. Python is a popular and flexible language that’s used professionally in a wide variety of contexts.

We teach Python for data science and machine learning, for example, but if you wanted to apply your Python skills in another area, Python is used in finance, web development, software engineering, game development, etc.

If you’re working with data, Python is the most in-demand programming language you could learn. Here’s data from open job postings on Indeed.com in February of 2021:

python is the most important skill for data scientist jobspython is the most important skill for data engineer jobspython is the second most important skill for data analyst jobs

Python skill set is in high demand right now, and is listed above every other technical skill in data scientist and data engineering job postings. It ranks second, behind only SQL, in data analyst job postings. Many jobs in all three areas will require both Python and SQL skills, but SQL is a query language. In terms of programming skills, Python is most in-demand.

Incidentally, we’re sometimes asked why Dataquest doesn’t teach Julia, which is a high-level and general purpose language that can be used to write code that is fast to execute and easy to implement for scientific calculations.

The charts above probably answer that question — our curriculum is focused on real-world skills. We choose what courses that are in the most demand in the job market.

Moreover, Python data skills can be really useful even if you have no aspiration to become a full-time data scientist or programmer. Having some data analysis skills with Python can be useful for a wide variety of jobs — if you work with spreadsheets, chances are there are things you could be doing faster and better with Python.

Recruitment

Essential Skills for Beginners to Land Their First Job

Starting your career journey can be both exhilarating and daunting. For beginners, understanding what skills are most sought after by employers can give you a significant edge. Whether you’re fresh out of school or transitioning to a new field, here are some key...

Free Online CV Builder – CV Tips and Free Templates

Free Online CV Builder – CV Tips and Free Templates

Welcome to the next step in your career journey! Crafting a compelling CV is more than just listing your experiences; it’s about strategically presenting your personal brand and the soft skills that make you unique. However, showcasing these skills on a CV can be...

Job Seekers

Essential Skills for Beginners to Land Their First Job

Starting your career journey can be both exhilarating and daunting. For beginners, understanding what skills are most sought after by employers can give you a significant edge. Whether you’re fresh out of school or transitioning to a new field, here are some key...

Free Online CV Builder – CV Tips and Free Templates

Free Online CV Builder – CV Tips and Free Templates

Welcome to the next step in your career journey! Crafting a compelling CV is more than just listing your experiences; it’s about strategically presenting your personal brand and the soft skills that make you unique. However, showcasing these skills on a CV can be...

Sapiens

Essential Skills for Beginners to Land Their First Job

Starting your career journey can be both exhilarating and daunting. For beginners, understanding what skills are most sought after by employers can give you a significant edge. Whether you’re fresh out of school or transitioning to a new field, here are some key...

Free Online CV Builder – CV Tips and Free Templates

Free Online CV Builder – CV Tips and Free Templates

Welcome to the next step in your career journey! Crafting a compelling CV is more than just listing your experiences; it’s about strategically presenting your personal brand and the soft skills that make you unique. However, showcasing these skills on a CV can be...