Foundations of Python Programming

Runestone Academy FOPP is a practical free online book with many projects and related ‘hands on’ theory, definitely recommended!

Note on graphics: to make activities more interesting, the book often asks to visualize data with the following libraries:

  • turtle is a Python module which was designed really only for didactical purposes. While fun, you will most probably want to try doing the same exercises using a more ‘serious’ library like matplotlib

  • cimage: this is a simple image manipulation library, made mostly for didactical purposes: you might want to try numpy and matplotlib instead

  • altair is a ‘pro’ library for cool interactive visualizations: we don’t treat altair in this book, you can try it or stick with the good old matplotlib

W3Resources website

Contains many simple exercises on Python basics, do them!

Software Carpentry

Software Carpentry is a website full of free educational resources, there is definitely a lot of good stuff to discover. We highlight these exercises (in tutorial format):

You may find other stuff in Community Developed Lessons for Jupyter and Python


Contains many python exercises with solutions. Here we put a small selection, for others you may look at ‘Very hard’ level, they are not so hard after all.

Edabit - Basics

Edabit - Strings

Edabit - Lists

Edabit - Dictionaries

Edabit - Matrices


Website with collections of exercises sorted by difficulty and acceptance rate, quite performance-oriented. You can generally try sorting by Acceptance and Easy filters.

We put here a selection.

LeetCode - Strings

Check string problems sorted by Acceptance and Easy. In particular:

LeetCode - Lists

Check array problems sorted by Acceptance and Easy. In particular:

LeetCode - Sets and Dictionaries

Check dictionary problems sorted by Acceptance and Easy.

Note: Keep in mind these problems are in section dictionaries for good reason: in order to execute fast they often require you to preprocess the data by indexing in it in some way, like i.e. putting strings in a set or as keys in a dicitonary so you can later look them up very fast.

WARNING: if you feel the need to use nested cycles, or search methods on lists/strings like .index, .find, in operator, .count, .replace on strings, try thinking first whether it is really necessary or you might use the above mentioned preprocessing instead.

Check in particular:

LeetCode - Matrices

Leet code - Graphs

Note: here on softpython we do not put links to exercises about visiting graphs, so for these you do not need stuff like breadth first search, depth first search, etc.


Contains many Python 3 exercises on algorithms and data structures (Needs to login)

Geeks for Geeks

Contains many exercises - doesn’t have solutions nor explicit asserts but if you login and submit solutions, the system will run some tests serverside and give you a response.

In general for Part A you can filter difficulty by school+basic+easy and if you need to do part B also include medium.

You can select many more topics if you click more>> un der Topic Tags:


Dive into Python 3

More practical, contains more focused tutorials (i.e. manage XML files)

Licence: Creative Commons By Share-alike 3.0 as reported at the bottom of book website

Introduction to Scientific Programming with Python

Focuses on numerical calculations, you can check first 7 chapters until dictionaries.

By Joakim Sundnes.

  • PDF for Python (only theory)

  • Exercises – a LOT of stuff, although some exercises are too much into engineering / maths compared to this book

  • EXTRA: if you like, it also contains chapters on classes which are certainly useful.

[ ]: