There are many resources to help you out develop your computational problem-solving skills with Python. Below there is a selection of resources (by no means exhaustive) which are amongst the best we are aware of and thus strongly recommended for this course.

Books#

The structure of the course does not follow any specific text book. Nevertheless, the following three books are excellent and strongly recommended:

  • Think Python: How to think like a computer scientist, 2nd Edition, by Allan Downey. The PDF of the book is available for free here. Other book related resources are available here. It is also available in paperback (published by O’Reilly, 2015). If you decide to get this book, it is important that you get the 2nd edition, which is written for python 3.x.

  • Introduction to Scientific Programming with Python, by Joakim Sundnes (published by Springer, 2020). An up-to-date (it covers Python 3.x), concise summary of the book in the next item. One of the hallmarks of this book is that is published under an open access license, and then can be downloaded for free from here. Highly recommended!

  • A Primer on Scientific Programming with Python, 5th Edition, by Hans Petter Langtangen (published by Springer, June, 2017). The book is example-oriented, with all applications taken from science, mathematics and engineering. Besides, just as this course, it targets newcomers to programming and Python. All examples are accompanied by complete program codes, which can be modified to the reader’s needs. IMPORTANT NOTE: this book is based on python 2.x, while this course focuses on python 3.x. In any case, the codes and examples in the book are still valid for our purposes and can be easily translated to python 3.x.

Python “cheatsheet” (click here)#

Most of the Python programming language syntax and features we are going to cover along this course are available at a glance in the “cheatsheet” available here (source: Laurent Pointal). We strongly recommend you to print it on a paper and stuck it somewhere where you can see while programming.

Online Python Tutor (click here)#

This is a fantastic tool for learning what happens with the variables and flow of execution in small programs. Every time you are a bit uncertain how the flow of statements evolves in a program with loops and/or functions, go to this URL, paste in your program and see exactly what happens.

Below is a program with a function named celsius_to_fahrenheit and a while loop, with the purpose of printing out on screen a table for conversion of Celsius to Fahrenheit degrees. Copy & paste this code into the Online Python Tutor editor area. Then Click Visualize Execution. Press the Next button to advance one statement at a time and observe the evolution of variables to the right in the window. You will be able to see how the program jumps around in the loop and up to the celsius_to_fahrenheit(celsius_degrees) function and back again.

def celsius_to_fahrenheit(celsius_degrees):
    """ converts celsius to fahrenheit degrees """
    fahrenheit_degrees = celsius_degrees * 9/5 + 32
    return fahrenheit_degrees

celsius_degrees = -30
delta_celsius_degrees = 10
while celsius_degrees <= 50:
    fahrenheit_degrees = celsius_to_fahrenheit(celsius_degrees)
    print(f"{celsius_degrees:5.1f} {fahrenheit_degrees:5.1f}")
    celsius_degrees += delta_celsius_degrees

Pyodide (click here)#

A Python interpreter that runs on your browser, thus allowing you to execute Python code easily from different devices. It includes many libraries and tools commonly used in scientific and numerical computing, such as NumPy and Matplotlib (which will be covered in this course).

bars search times arrow-up