It’s often said that the best way to learn to write programs is to write programs. This page lists a number of places you can go for ideas about what programs to write to develop your Python skills. Some sites offer Python-focused problems, which typically are aimed at helping you learn more about the language and how to use it more effectively. Other sites offer challenges that can be solved in any language. These are typically aimed at helping you develop your programming skills and become better at solving problems.
NOTE: This is a work-in-progress. The resources listed have only been lightly curated, and there are likely other great ones that should be on this list. We welcome suggestions.
Places to ask for help when you’re stuck
- The Boston Python Slack workspace
- Stack Overflow is a good place to find quick answers to specific technical questions, but is usually not a good place for involved discussion about logic or problem-solving.
Python-specific exercises
-
exercism: Crowd-sourced
code practice and mentorship for everyone
, with over 100 Python-specific exercises. Installing their command-line interface can be a little complicated, but after that the submission system is smoother than many online exercise portals. Exercises are submitted and maintained by volunteers, as a result some exercise descriptions may be incomplete or confusing. -
edabit:
Learn to code with interactive challenges
, with Python exercises for all levels. -
Practice Python: 30+ Python exercises for beginners.
-
CheckIO: Coding games to improve your skills by solving engaging challenges and fun tasks using Python.
-
Python Koans: A set of exercises for python and test-driven development for beginners.
-
PyBites Blog Code Challenges:
Free form, open ended, mini coding projects designed to take anywhere from a day to a week
. Each challenge includes optional instructions for submitting your solution using GitHub.
More resources
- Software Engineering: Python for Beginners has a list of other Python resources that could be helpful for beginners.
Language-agnostic coding challenges
-
Advent of Code is a Christmas-themed problem set that has offered 25 new programming challenges every December since 2015. Each set is a collection of well-made problems that challenge your ability to reason algorithmically. Problems range from moderate to difficult.
-
Rosalind is a bit of a hodge-podge, offering a well-curated collection of problems introducing concepts in bioinformatics, a small set of introductory Python problems, and a collection of classical algorithms to implement.
-
Project Euler is great fun for the mathematically-minded. Over 650 problems which ramp up rather quickly in difficulty. If you’ve got a strong mathematical background you’ll have a real advantage here. If not, you might well acquire one.
Sites that cost money
-
Python Morsels: A short Python exercise every week, followed a fews days later by a number of idiomatic solutions, with explanations of each one.
-
PyBites:
Hone your Python skills by coding and verifying exercises in the comfort of your browser.
Offers a small number of free exercises, but most require buying a bundle or monthly subscription. Exercises are grouped by skill level (Bites of Py) and topic (Learning Paths).
Books
There are thousands of books on programming in Python. This list focuses on titles helpful for beginners and advanced beginners. Most of the titles are available for free online or through a Boston-area library system (Minuteman Library Network or Boston Public Library), as well as for purchase through your favorite bookseller.
NOTE: This list was originally compiled by a non-beginner. If you are a beginner, we will be grateful for your feedback.
-
Think Python! by Allen Downey. This book starts from the most basic programming concepts and works toward a computer-science mindset as well as Python fluency. While no book is perfect for all readers, this one has found broad appeal with many beginners. The website has free PDF and HTML versions.
-
Python Flash Cards by Eric Matthes. More like a deconstructed book, this box of 101 cards covers the basics of Python in a stripped-down fashion. These are not like traditional flash cards, which present a single concept per card. Each card is more like a quick reference for some piece of the larger Python puzzle. Potentially useful for beginners looking to review their understanding. Libraries: MLN.
-
Automate the Boring Stuff With Python by Al Sweigart. A practical guide to the sorts of things that you can do with Python, how to do them, and why to do them that way. Recommended for those who have some understanding of Python and want to apply and improve their knowledge. Experienced programmers without previous Python exposure will probably be able to make good use of this book as well. The adventurous beginner might be able to make reasonable progress using the introductory chapter to learn Python fundamentals, but this is probably not an ideal place to start your Python journey. The book’s content is available for free on the website. Libraries: MLN, MLN 1st ed, BPL 1st ed.
-
Cracking Codes With Python by Al Sweigart. Probably less practical than the author’s book on automation, this book is a concrete review of Python programming techniques through an exploration of basic cryptography. Recommended for the advanced beginner interested in dipping their toe into the world of codes and information. This book will not bring you up to speed with modern crypto, which is extremely math-intensive, but it shows how to write programs to solve well-defined problems. The book’s content is available for free on the website. Libraries: MLN.
-
Impractical Python Projects by Lee Vaughan. Somewhat more advanced than Sweigart’s books, this book goes deep into Python libraries to do interesting and completely impractical things, such as using NLTK to write haikus, using PyGame to simulate alien volcanoes, or using Pillow to improve your astrophotography. Recommended for the more advanced beginner. If you’re comfortable writing standard Python, this book will show you how to use other people’s libraries to do cool things easily. Libraries: MLN, BPL.
-
Think Stats! and Think Bayes! by Allen Downey. These books are aimed at teaching probability & statistics and Bayesian statistics, using Python rather than traditional mathematical expressions to make the concepts concrete. Recommended for more advanced beginners with an interest in the mathematical underpinnings of statistics. The website for both books has free PDF and HTML versions.
-
Python Tricks: The Book by Dan Bader. This is a great book for those who are comfortable with the basics of Python and would like to learn some more advanced tricks, such as decorators, abstract base classes, named tuples, and more. The author runs the Real Python site which has a lot of in-depth Python tutorials. A short PDF sample is available. Libraries: MLN, BPL