How to Learn Python: A 5-Step Guide
Python is one of the most popular programming languages in the world. If you’re interested in technology, choosing to learn Python is a great decision. But how should you learn Python? What is the best way to become a Python programmer?
While there are many approaches to learning programming, my suggestion is to go for a blend of both theory and practice: learn new concepts and put them into practice immediately.
Focusing too much on theory can leave you paralyzed. You will fill your head with an impressive mountain of concepts, but, without practice, you won’t be able to translate that knowledge into real, useful Python code.
Last Updated April 2021
Build 11 Projects and go from Beginner to Pro in Python with the World’s Most Fun Project-Based Python Course! | By Ziyad Yehia, Internet of Things AcademyExplore Course
On the other hand, focusing too much on practice can be very painful and frustrating. You end up repeatedly making the same mistakes because you don’t understand why you are making them. Even though you may eventually build things that work, you will be left with a weird feeling in your stomach that you don’t really know how to code; that you’re just hacking things together. You might even feel like a bit of a fake.
Based on the downsides of these two extremes, I believe the best way to learn Python is to take a blended approach: learn the theory but put everything you learn into practice immediately.
Here is a roadmap of what this approach looks like in the context of learning programming in Python:
1. Master Python’s building blocks (Python syntax)
Have you ever heard the saying “the journey of a thousand miles starts with a single step”? Well, this is true for learning Python, too.
Most of us usually want to jump to the fun part of writing code and building stunning apps right away.
While this is an exciting aspiration, we know deep down that it is crucial for us to first master the building blocks; first, we need to learn the basics.
Without solid foundations, you can’t go very far; but with solid foundations, you can go anywhere.
While you need to gain a solid grasp of the basics, you probably don’t want to be stuck learning the basics forever. So how long should you spend at this stage?
I’ve written another article on how long it takes to learn the basics of Python, and in that article, I present a step-by-step plan you can use to master the basics of Python in about six weeks.
If you’re in a rush and have the time to dedicate, I also share a couple of tips in that article that can help you cut your learning time down to about three days. It’s definitely something worth checking out.
Syntax refers to a collection of rules that a programming language follows to create a complete block of code.
When learning the Python syntax, you should focus on the following 8 topics:
- Numbers and arithmetic operations
- Strings and string manipulations
- Logic and Conditional Flow
- Data structures (lists, tuples, and dictionaries)
- Loops (‘for’ loops, and ‘while’ loops)
- Object-Oriented Programming (Classes and Objects)
If you master these topics, you can confidently say that you know how to code in Python. Another phrase used in the Python community for this is “pythonic code”. There’s always more to learn in the tech world, but these topics are going to be your bread and butter for most things you want to code.
For a detailed breakdown of how to approach each of these topics, check out this step-by-step plan for learning Python.
Remember, the most important part at this stage is to not only grasp the concepts but also apply them in some practical way.
Now, what do you do when you’ve mastered the basics?
2. Pick a specialty
This is the point where most people get stuck after they have started learning.
Thanks to Python’s simple syntax, most people gain a solid grasp of the basics, but then they don’t really know what to do next.
At this stage, it is important to realize that Python is just a highly flexible and powerful tool. You can use Python in many ways, but it’s up to you to decide exactly how you would like to use it.
So, how can Python be used to solve problems?
Well, Python is very popular across many industries in the software development world, including:
- Web application development
- Data science & analytics
- The internet of things (robotics & sensors)
- Desktop + mobile application development
- Machine learning & artificial intelligence
I have written a more detailed article on this topic, where you can read more about how Python is used in each of those industries.
So, which is the best choice? Well, the answer to that question is totally up to you.
Here are three points to consider when deciding what you would like to pursue:
- What are you most interested in?
- What background skills do you have that might fit well with each of these areas?
- Is it something you think you could become good at, rather than just interested in?
If you’re finding it hard to decide, remember: it’s not like you’re signing your life away here.
You can always pick a specialty, try it out, and if it turns out to not be a good fit, pick another.
That said, whichever route you pick will involve hard work. There will be things you like about the topic and things you don’t like.
All of that’s okay because navigating these difficulties is what makes mastering something so worthwhile in the first place.
Whichever specialty you pick, try to stick with it for as long as you can.
3. Master the theory and frameworks of that specialty
So you’ve decided on a specialty that you would like to pursue. Congrats!
However, that’s only half of the battle. Now, you have to get good at it!
In order to gain more experience in your chosen specialty, we are again going to use our blended approach of theory and practice.
The theory side of things changes a bit here, though.
Let’s say you picked data science as your specialty. Here’s how I would suggest you approach mastering it:
- The theory of data science as a topic
- The theory behind Python’s frameworks and libraries for data science
- Practice actually using the Python libraries and frameworks for data science to perform data science tasks
Notice that the theory side of things now has two components.
There is the theory of data science as a topic:
- What are the key theories and concepts?
- What are the key applications of data science?
- How is the subject put together?
- What is the history of the field, and where is it headed?
- What are its key challenge areas?
Remember, Python is just a tool that will help you perform the mechanical tasks involved in applying the theory. Unless you understand the field, you will find it difficult to put your Python skills to use within that field.
At the same time, knowing a lot about the field of data science does not mean that you know how to use Python for data science. That requires a more specific focus on the different ways that Python is used within the field.
Using our data science example again, here are some questions you could ask at this stage:
- What Python frameworks exist for data science?
- How are they different from each other?
- What are their intended use cases? What problems do they try to solve?
- How are those frameworks built up, and how do they work?
Finally, you can focus on gaining practical experience with applying those Python libraries and frameworks to common and basic problems within your chosen field. By now, you should have a good idea of what these are and should be able to experiment. You will be able to find online Python tutorials that will guide you in your experimentation.
I have presented the flow here as a linear three-step process, but really it is an iterative and interconnected one. One day you will be learning about the field, another day you will be learning about relevant Python frameworks, and another day you will be tinkering with code; perhaps you will even be doing all three at once.
The key here is balance. On one hand, you don’t want to be so rigid and linear that you wait months before you start practicing. On the other hand, you don’t want to be so erratic that you never learn anything deeply. You are the best judge of what balance will mean for you in this situation.
4. Learn to work together with other developers
So, by now, you’ve:
- Mastered the basic building blocks of Python
- Figured out what area of application you want to focus on
- Gained some practical experience with applying the core concepts and Python frameworks appropriate to that area.
This reminds me of a cool African Proverb:
“If you want to go fast, go alone. If you want to go far, go together”.
The best software is rarely built alone. There might be less administrative baggage with “going solo”, but to produce significant and impactful work, you need a team.
The idea of a “lone wolf” inventing world-changing software from their University dorm room is, in most cases, an urban myth.
Mark Zuckerberg had a computer scientist father; Steve Jobs had Steve Wozniak, and Bill Gates had Paul Allen.
No one is great at everything, and no-one is self-sufficient. We need other people, and we all shine brighter when we work together.
Learning to work with others is one of the greatest things you can do on your path to become a Python developer.
Working with others will give you the environment and exposure you need to thrive and become an experienced programmer, and the relationships you form will inspire you and help you stay motivated when the going gets tough.
Okay, so how do you find a team?
Well, there are plenty of ways to work with other developers, especially in the open-source community.
- Go on EventBrite, register for an online hackathon, and join a team that has a cool idea
- Find an interesting project on Github and contribute to it (even if that means just writing documentation)
- Brainstorm some ideas with a friend that you can build together
- Find a community on Reddit, make friends, and ask people if they want to work with you/provide feedback on a project you’re building.
It’s impossible to put all the things you’ll learn at this stage into words.
To put it simply: everything will make sense to you, and everything will become real.
Oh, and if you’re struggling to come up with project ideas, check out this list for inspiration.
5. Keep learning & practicing
Like most things in tech, mastering Python involves continuous learning.
One of the most exciting parts about technology is how rapidly it evolves and changes. There’s always something new to learn, and every great developer adopts an attitude of lifelong learning, practicing, and experimenting.
So, the final tip is to keep at it! Just keep exposing yourself to new things, and keep trying to learn and practice new topics, and life will take care of the rest.
If you enjoyed this article and are just at the start of your journey, I invite you to check out my Python Bible Course on Udemy.
The Python Bible has helped over 100,000 people, just like you, learn to code.
It is tailored perfectly to the needs of Python beginners, and it really stands out for being fun and project-based.
Following my philosophy of blending theory and practice, all the concepts you learn in the course will be used to build a set of 11-fun Python projects, from a baby simulator to an X-O game.
If that sounds like fun, then I’d love to see you in the course.
Either way, I hope you have found this article useful, and happy Pythoning!
Top courses in Python
Python students also learn
Empower your team. Lead the industry.
Get a subscription to a library of online courses and digital learning tools for your organization with Udemy for Business.