How to Learn Python (Step-by-Step) in 2021
How to Learn Python (Step-by-Step) in 2021
Step 1: Learn the Basic Syntax
Unfortunately, this step can’t be skipped. You have to learn the very basics of Python syntax before you dive deeper into your chosen area. You want to spend the minimum amount of time on this, as it isn’t very motivating.
I can’t emphasize enough that you should only spend the minimum amount of time possible on basic syntax. The quicker you can get to working on projects, the faster you will learn. You can always refer back to the syntax when you get stuck later. You should ideally only spend a couple of weeks on this phase, and definitely no more than a month.
Also, a 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 2: Make Structured Projects
Once you’ve learned the basic syntax, it’s possible to start making projects on your own. Projects are a great way to learn, because they let you apply your knowledge. Unless you apply your knowledge, it will be hard to retain it. Projects will push your capabilities, help you learn new things, and help you build a portfolio to show to potential employers.
However, very freeform projects at this point will be painful — you’ll get stuck a lot, and need to refer to documentation. Because of this, it’s usually better to make more structured projects until you feel comfortable enough to make projects completely on your own. Many learning resources offer structured projects, and these projects let you build interesting things in the areas you care about while still preventing you from getting stuck.
Step 3: Figure Out What Motivates You to Learn Python
Before you start diving into learning Python online, it’s worth asking yourself why you want to learn it. This is because it’s going to be a long and sometimes painful journey. Without enough motivation, you probably won’t make it through. For example, I slept through high school and college programming classes when I had to memorize syntax and I wasn’t motivated. On the other hand, when I needed to use Python to build a website to automatically score essays, I stayed up nights to finish it.
Figuring out what motivates you will help you figure out an end goal, and a path that gets you there without boredom. You don’t have to figure out an exact project, just a general area you’re interested in as you prepare to learn Python.
Pick an area you’re interested in, such as:
- Data science / Machine learning
- Mobile apps
- Websites
- Games
- Data processing and analysis
- Hardware / Sensors / Robots
- Scripts to automate your work
Yes, you can make robots using Python! From the Raspberry Pi Cookbook.
Figure out one or two areas that interest you, and you’re willing to stick with. You’ll be gearing your learning towards them, and eventually will be building projects in them.
Step 4: Work on Python Projects on Your Own
Once you’ve completed some structured projects, it’s time to work on projects on your own to continue to learn Python better. You’ll still be consulting resources and learning concepts, but you’ll be working on what you want to work on. Before you dive into working on your own projects, you should feel comfortable debugging errors and problems with your programs. Here are some resources you should be familiar with:
- 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.
Once you have a solid handle on debugging issues, you can start working on your own projects. You should work on things that interest you. For example, I worked on tools to trade stocks automatically very soon after I learned programming.
Here are some tips for finding 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.
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.
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.
You can choose a new project that
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 evolving all the time. There are only a few people who can legitimately claim to completely understand the language, and they created it.
You’ll need to be constantly learning and working on projects. 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. Working only on things that interest you means that you’ll never get burned out or bored.
Python is a really fun and rewarding language to learn, and I think anyone can get to a high level of proficiency in it if they find the right motivation.
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 frustrating moments, because you'll be working on projects that genuinely interest you.
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.
How can I learn Python faster?
Unfortunately, there aren't really any secret shortcuts! 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. 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:
Comments
Post a Comment