The Best Way to Learn Python
The best way to learn python starts with deciding what you want to build. Next you'll want to find a course or some resources to help guide you through developing your idea. When learning python it's very important to start with an idea. If you try to build something you're interested in, it makes the process more immersive.
Last month I discussed why you should learn the Python programming language. Today I’m going to show you how to learn Python using ten of my favorite resources.
Whether you’re a seasoned code-slinger or this is the first time you’ve written a line of code, these resources will undoubtedly be helpful on your journey to Python mastery.
When it comes to learning both the Python programming language and web development using Python, I recommend the RealPython course.
This course starts with the basics of the Python programming language (for both Python 2.7 and Python 3) and moves on to web development using Django, Flask, and web2py. These are currently the most popular Python web frameworks that you’ll encounter in your career as a Python web developer.
Not only will you learn Python best practices, but you’ll also discover how to utilize tools such as Vagrant, Git, Heroku, and others. These tools can be used to actually build and ship your Python application once you’ve finished coding it.
I’ve personally worked through this course and subsequently recommended it to my colleagues, who came to me asking for good resources for learning the Python programming language. Each of them were thankful that I recommended the course.
Michael, Jeremy, and Fletcher (the course authors) are all really nice guys who go out of their way to help answer your questions, ensuring you’re able to learn the Python programming language effectively. They even offer one-on-one mentoring in their upgraded course package.
Whether you have prior programming experience in another language or this is the first time you’ve written a lot of code, you should take a look at the Real Python course.
The Python Jumpstart course was created by Michael Kennedy, host of the popular Talk Python to Me podcast. I personally backed Michael’s Kickstarter campaign back in 2016 to fund the creation of the course. Since its release, I have gone through the lessons and thoroughly enjoyed the experience.
Michael’s course is geared towards readers who already have some amount of programming experience and want to quickly get up to speed with Python.
This course also focuses on how to learn Python by building projects rather than indexing on language fundamentals through contrived examples. There are too many courses/books that simply explain how to code rather than requiring you to apply your newly gained knowledge to solve real-world problems; Michael’s course is not one of these dry, boring tutorials.
Inside Python Jumpstart you’ll learn how to:
- Build a simple weather client (HTTP clients, screen scraping, external packages).
- Create a real estate price analyzer (file formats, list comprehensions, generators).
- Construct a personal journal application (text-based file I/O).
If you’re the type of person who learns in a “hands-on” fashion, you’ll love this course. Michael does an excellent job of teaching through practical projects, and I highly recommend his resources if you have programmed in another language before.
A classic in the Python education space, Learn Python the Hard Way is an ebook by Zed Shaw, a software developer and creator of the Mongrel web server for Ruby.
Zed’s teachings follow a simple three-step formula:
- Go through each exercise.
- Type in each example exactly.
- Make it run.
Yes, it’s difficult.
Yes, it will be a bit frustrating.
And yes, you may find the lessons a bit dry at times.
But Zed’s approach works.
We often struggle when thrown into the deep end of the pool, but Learn Python the Hard Way will help you tread water, eventually teaching you how to swim on your own.
If you’re new to the programming world (<1 year of experience), then I would recommend this resource to you — but if you’re already a seasoned programmer, you’ll find more value out of the Real Python and Python Jumpstart courses, as they are more practical and demonstrate how to build actual applications rather than code snippet examples.
All that said, I do want to call out an important nuance regarding this book, one that is often missed by beginner programmers:
As you become more experienced with the Python programming language, you’ll likely find yourself putting down this book and moving to other resources.
The reason is that Learn Python the Hard Way uses Python 2.7 and has not been updated to cover the newer Python 3.
While this isn’t a deal breaker (remember, the most important step you can take when learning Python is to actually get started), it does become frustrating when you try to run your Python 2.7 code in a Python 3 interpreter and have no idea why your code is failing and throwing errors.
If you decide to go with this book, keep this nuance in mind, and you’ll be okay. I would also recommend investing in a good Python 3 resource, such as O’Reilly’s definitive Python “bible” (detailed later in this list).
One of my favorite online courses to learn Python from is Code Academy.
I first stumbled upon Code Academy and their teaching products one-and-a-half years ago when I was developing a course on Python, computer vision, and OpenCV. I eventually landed on the Code Academy website and decided to give their course a try.
The exercises are fun and interactive, meaning you can code inside your browser. This is a huge benefit for readers who are new to the language and simply want to get started learning without having to download any software or configure their machine.
The ideal audience for Code Academy’s Learn Python course are programmers with little to no experience. If you have more than 6-12 months of coding experience under your belt, you may find the tutorials are a bit “gimmicky” and lacking in technical depth.
The downside is that while this course is currently available, it will be taken offline in summer 2017 for a refresh. If I were you, I would jump into this course immediately.
Similar to Code Academy’s Learn Python course, we have another one offered by Code School.
I personally prefer the course offered by Code Academy; however, while Code Academy’s course gets a facelift, you should consider giving Code School’s lessons a try.
However, be careful with courses such as Code Academy and Code School. While these courses will absolutely teach you how to program, it is easy to miss the bigger picture: how to build and ship complete applications.
Learning how to program isn’t about earning badges and decorating your online profile. Instead, it’s about writing software that solves actual problems.
You’ll learn how to write code inside Code Academy and Code School, but if your end goal is to obtain a job as a Python programmer, you’ll want to supplement your education with a course from Real Python or Python Jumpstart.
Python for Entrepreneurs is another course by Talk Python to Me podcast host, Michael Kennedy. I like to recommend this course to students who have an “entrepreneurial edge” to them. They aren’t just interested in learning how to write code; they want to use their knowledge to build an actual company.
As I mentioned above, programmers are not hired just because they know how to code. They are hired because they can solve problems with code. The difference is subtle, but it’s important to note.
The Python for Entrepreneurs course assumes you know the basics of the Python programming language, then leverages these fundamentals to help you level-up your skills by building an actual online business.
Michael Kennedy and Matt Makai (of Full Stack Python) use the example of building an e-commerce website, demonstrating how to:
- Accept credit cards for payments.
- (Safely) store user credentials in a database.
- Send outbound emails.
- Set up SSL certificates.
- Deploy your application to cloud servers.
While this course is currently in pre-order, I’ve had a sneak peek at the content and can tell you that it’s well worth it.
While many readers are interested in learning Python for web development, there are many other uses for the language — a major one being data science.
If you have any interest in exploring a career in data science (including machine learning, deep learning, computer vision, statistical analysis, etc.), you’ll need to become familiar with not only the Python programming language, but also the NumPy and SciPy libraries as well.
Going through Intro to Python for Data Science is a great way to learn all three.
It’s hard to create a list of Python programming resources without mentioning O’Reilly’s classic book, now in its fifth edition.
While this is an excellent resource, my biggest problem with this book is its sheer size. Coming in at a whipping 1,648 pages, this book does an excellent job of covering both Python 2.7 and Python 3; however, I recommend using this book to supplement your education once you’ve gone through a few chapters/lessons from the other more hands-on resources I’ve mentioned in the rest of this article.
Arguably my favorite Python tool for beginners, Al Sweigart’s Automate the Boring Stuff with Python is a “must have” if you learn by practical examples.
This book makes no assumptions regarding your prior programming experience but at the same time teaches you how to write software by building simple (automated) applications, such as:
- Searching for text in a text file.
- Creating, renaming, and moving files on your system.
- Sending out TXT reminders and emails.
- Updating data in an Excel spreadsheet.
I would suggest using this book in tandem with a Code Academy or Code School class, so you can learn how all the Python “puzzle pieces” fit together to create solutions to actual problems.
Looking for a free resource to jumpstart your Python career?
If so, I would highly suggest the Learn Python, it’s CAKE course from Jay Elbourne. All you need is a (free) Udemy account, and you’ll be able to access over seven hours of video tutorials, starting from the very basics (how to install Python on your system) all the way up to building small applications.
My personal suggestion would be to take this course and then purchase a more project-based book such as Python Jumpstart or Automate the Boring Stuff with Python.
If you’re interested in the world of computer vision and image processing (i.e., writing software that can understand and interpret the contents of an image), you might be interested in my book, Practical Python and OpenCV.
Inside the book you’ll learn how to:
- Detect faces in images and video.
- Recognize handwriting.
- Utilize your Raspberry Pi for computer vision.
- Track objects in video streams.
- Build a computer vision system to identify the covers of books.
While my book assumes you have basic Python experience, I take the time to explain each example line-by-line, ensuring you understand what each line is doing.
As a result of this practical, hands-on approach, I’ve had a number of readers come back to me and say that the book not only helped them learn the basics of computer vision/OpenCV, but helped them learn Python as well!
If you are interested in utilizing the Python programming language to analyze images and understand their contents, take some time to learn the fundamentals of the language (i.e., if, for, while, etc. constructs), then take a look at Practical Python and OpenCV.
Python Anywhere isn’t a book, course, or tutorial you can use to learn Python. Instead, it’s a full-fledged Python environment that runs in your web browser.
With Python Anywhere, there is nothing to download and nothing to install — just open your browser, point it to the PythonAnywhere.com domain, and start coding. If you find that you like the Python Anywhere service, you can upgrade your account for a small fee and have access to more CPU cycles, web traffic, and disk space.
If you are struggling to install and configure Python on your system, start with Python Anywhere while you learn the basics and then return to the install process later on.
Remember, the most important step you can take when learning Python is the first one: actually getting started!
Have Another Resource You Recommend?
Last month I shared seven reasons from my personal experience why you should learn the Python programming language. My goal here today was to help provide a list of resources that you can use on your own Python programming journey.
Do you have personal experience with any of the resources I listed above?
Did I miss a book or course that you recommend?
Be sure to leave a comment in the form below and let us know!