The Top 7 Best Github Repositories to Learn Python

 

Popular repositories to either learn the basics or develop mastery of Python

Image for post
Art by siscadraws

All roads lead to GitHub.

You may remember a similar article I published called “Top 4 Repositories on GitHub to Learn Pandas”. There, I said I was afraid of using anything more than git commit + git push because GitHub is scary. I’ve progressed a little bit: now I remember to hit git pull every time I have fresh work (instead of screaming internally when I try to push my edits and realize that my local repository wasn’t up to date with the master branch).

This time, I decided to compile a similar list of learning resources for Python! Some of them contain tutorial-style Jupyter notebooks, whereas others feature extensive collections of programming problems. All of them have the potential to be useful, depending on your preferred learning style.

If you haven’t used Python at all before, you may benefit from the repositories that have resources for complete beginners. If you’re already comfortable with Python and you’re looking to brush up on a particular subject, say algorithms, there’s also a repository just for you!

learn-python3 — Beginner to Intermediate (1.8k stars)

Image for post
learn-python-3 on GitHub by jerry-git

This repository takes you through 19 Jupyter notebooks in its beginner section. It covers foundation-level like strings and conditionals, then goes a bit deeper by discussing classes (a really quick introduction to object-oriented programming), exceptions (what they are and how to handle them), and some features included in the Python standard library (datetime, regular expressions, and more).

Each topic has a “notebook” link, which brings you to an introduction of the topic and some sample code. After you go through that, there’s an “exercise” link, which takes you to a notebook with sample problems that you can fill in and test.

Image for post
Sample exercise notebook from jerry-git

Then, there’s an intermediate “idiomatic” section. This section describes “Pythonic features”, which are features in Python that aren’t present in many other programming languages. If you’re already familiar with a different language, you may want to check this section out for tips and tricks on working specifically with Python. For example, there’s a section on how to approach loops in Python differently than with other languages.

Image for post
Sample idiomatic notebook from jerry-git

This repository also has a link to a handy “best practices” notebook, which you can use to learn about what practices you should implement when creating Python projects. It covers things like setting up a virtual environment with pipenv and using pytest for (you guessed right) testing.

learn-python — Beginner to Intermediate (3.9k stars)

Image for post
learn-python on GitHub by trekhleb

This repository also serves as an introduction to Python that can bring you from beginner to intermediate (and by intermediate I mean comfortable with using the language beyond simple loops and arithmetic). Instead of using notebooks, the repository is a collection of Python scripts, each of which is a sub-topic of a core category like “Operators”, “Data Types”, and “Control Flow”.

Image for post
Sample sub-topic Python file by trekhleb

Each Python file demonstrates the sub-topic in question as well as a helpful link that you can visit for more information. This can be helpful if you’re unclear on what the code does and need to quickly review some theory.

Two important features included in the repository as you work with the Python files are testing and style checking. You can see the full details under “How to Use This Repository”, but for testing, the author includes lines with assert at the bottom of the main function to see if the function is performing as it should. This can be useful if you want to make changes to the code and see if it still functions properly. There are instructions for how you can actually run the tests with pytest. Also, to get into a habit of following Python’s main style guide (PEP 8), there are further instructions for you to run pylint on the code to see if the Python files comply with the style guide.

You don’t have to follow the course in its entirety, as the author notes that you can also use the repository as a cheat-sheet. You could simply find the section you’re looking for, review the documentation, play around with the code, then run tests and lint the code to see if it’s working and written as it should be.

full-speed-python — Beginner to Intermediate (2.6k stars)

Image for post
full-speed-python on GitHub by joaoventura

This repository features a book that quickly goes through the basics of strings and lists, then dives quickly into relatively more advanced topics like “Classes”, “Coroutines” and “Asynchronous Programming”. The author wrote the book with a practical approach in mind, briefly introducing each topic with code examples and then jumping straight to practice problems that readers can try on their own.

You can either download the pdf/epub file from the link the Readme, or you can clone the repository and build it yourself.

The author writes that “Distributed Computing students taking a software engineering degree became familiar with Python in two weeks and could implement a distributed client-server application with sockets in the third week”. If you already have some software engineering experience in another language, or if this isn’t your first programming language, using this book may help quickly get you up to speed with Python.

python_reference — Intermediate (2.3k stars)

Image for post
python_reference on GitHub by rasbt

This repository is not a tutorial-style resource with groups of concepts like the previous repositories. Instead, this repository is more of a collection of different notebooks on intermediate-level topics like “SQLite database operations in Python” and “Parallel processing via the multiprocessing module”. If you already have a solid foundation in Python, this resource may be useful to help you really take advantage of different features of the language. As with the previous repositories, this one also includes notebooks with code that you can edit and run.

Image for post
Sample tips notebook by rasbt

The aptly named “not so obvious Python stuff” notebook (snippet above) gives a rundown of various Python and Python module features that you may not have learned while studying the absolute basics. You never know when that random tip could help your work in the future. While it’s great to build depth of understanding when you’re just starting with Python, once you’ve learned enough of the basics, it can help to go through a compilation of unrelated tips like to broaden and fill gaps in your knowledge.

There are also helpful non-code resources which the author has linked to which serve more as “theory resources”. For example, the author created one called “Unit testing in Python — Why we want to make it a habit”.

Image for post
Sample theory resource by rasbt

The author has also linked many other external resources they found useful for learning Python, including forums, books, and existing Python projects. The r/Python on Reddit, for example, is a great place to find helpful Python tips as well as personal projects that community members showcase.

Python-programming-exercises — Beginner to Advanced (10.8k stars)

Image for post
Python-programming-exercises on GitHub by zhiwehu

This repository currently features one hundred Python programming exercises, ranging from beginner to advanced in difficulty. The questions and solutions were originally written in Python 2, but the author has since updated all 100 questions to include solutions written in Python 3.

Image for post
Sample exercises by zhiwehu

If you’re already familiar with Python, some of these questions may seem too easy. I’d say being able to solve the easy questions is one thing, but being able to whiz through them is another. Going through all these problems, maybe in tandem with an online course you follow or the resources from one of the GitHub repositories here, can help prepare train you to solve programming exercises.

If you get stuck, you can use the “hint” line present at every problem to try and figure out how to approach the problem. Try not to scroll too far down for each question so you don’t see the solution right away because the process of trying to figure out the solution to a problem help you really remember the solution (instead of just trying to read and memorize the solution).

Image for post
Sample exercises by zhiwehu

There’s also an “extended version” of this repository by a different author with the same questions and alternate solutions. In this extended repository, the author attempts to show the different ways one problem could be solved, which may be more efficient or “Pythonic” than the original solution.

Image for post
Sample exercises by darkprinx

coding-problems — Intermediate to Advanced (2.6k stars)

Image for post
coding-problems on GitHub by MTrajK

Just like the previous repository, this one contains a comprehensive list of programming and algorithmic exercises that you can solve. However, instead of having all the exercises in a notebook, this repository has a Python file for each exercise, with a description of the problem and then what a solution for it would look like.

Image for post
Sample exercise by MTrajK

These questions don’t start at a complete beginner level of difficulty, so I would suggest coming to these once you already have a solid grasp of the basics (using functions, control flow, etc.).

The author also writes that “algorithms and structures and not language-specific”. Because of this, he wrote the solutions in Python because of the language’s readability, but people comfortable in other languages should be able to use this repository as well to see how to approach algorithmic problems.

The problems in this repository are not written originally by the author, as he explicitly states that they come from problem-solving sites like LeetCode. His contribution is providing solutions and explanations to help people learn how to solve these types of problems.

You’ll find that many problems can be grouped under a one main topic, so the approach to solving those problems may be somewhat similar. As you keep practicing the same types of problems in one topic, you should find that they become progressively easier for you to solve.

In addition to the Python files with algorithm questions and solutions, he also includes a comprehensive list of other resources for you to use. There are many online courses, recommended books, and links to popular sites for programming problems.

TheAlgorithms — Intermediate to Advanced (82.4k stars)

Image for post
Python on GitHub by TheAlgorithms

This repository also features a collection of files that show you how different algorithms can be implemented in Python. These algorithms are grouped into categories from “Arithmetic Analysis” to “Blockchain” to “Data Structures” and even more. There isn’t as much explanation on how to solve each problem, as this repository can serve as a solution guide to implementing different algorithms.

Image for post
Sample algorithm solution by TheAlgorithms

Some files do give you a bit of context (and a link or two to get you started), but you may have to do some research on your own before you try to solve these algorithms. If you’re completely new to Python, I would suggest building your fundamental knowledge first, as this repository is really for those that are already comfortable with the language and are looking to deepen their knowledge on algorithms.

The author has also created similar “learning algorithms” repositories for a few other major languages (Java, C++, C, Go, Javascript), which you can check out on the profile’s pinned repositories.


GitHub repositories contain a wealth of valuable learning resources, but that doesn’t mean you need to use all of them. My suggestion is to first take one of the “beginner to intermediate” type repositories and work through all the learning material in it. You should work through the repository that best fits your learning style. For example, if you want to learn through editable Jupyter notebooks that take you from basic to intermediate topics, you should try the first repository in this piece.

In addition, the two 100+ Python problems are great for you to use as an introduction to solving programming problems. You can choose to either start trying a few every day or wait until you have a more solid foundation in Python first. These can eventually help you build some basic knowledge for the types of programming questions that could come up in technical job interviews. You could progress from these to sites like HackerRank and LeetCode, which also give you various programming problems to solve every day. They can also help you prepare for job interviews at specific companies, like Facebook, Amazon, and Google.

Learning Python (and anything really) is all about staying motivated and practicing. Python isn’t magic- make a plan and use one of these repositories if they fit (or use something completely different if they don’t) and stick with it.

You got this!

Comments

Popular posts from this blog

Easy Text-to-Speech with Python

Flutter for Single-Page Scrollable Websites with Navigator 2.0

Better File Storage in Oracle Cloud