Programming Foundations#

Welcome to Programming Foundations! This book is part of the introductory programming course in the Bachelor’s program in Nanobiology at TU Delft. It aims to introduce students to programming in Python and working with computers. Many exercises and examples in this book are rooted in nanobiology, i.e., at the intersection of biology, physics, and mathematics.

Programming has become an indispensable component in the skills repertoire of scientists and engineers. It is at the very core of theoretical research - modelling and simulations - as well as an invaluable supporting tool for experimental research - data analysis, visualization, and automation of repetitive tasks. Moreover, with the recent advances in artificial intelligence as well as the increasing number of large datasets produced by experiments, e.g., omics experiments, learning how to program will allow you to leverage these developments.

In this book, we will first familiarize ourselves with the core concepts and tools needed to work effectively with Python and computers in general. Next, we will explore the fundamentals of computer programming using Python, honing our skills with relevant examples from the field of nanobiology. As you progress through the book, you will notice that concepts build on one another. We will start with the basic building blocks of Python, such as variables. From there, we’ll learn how to gain more refined control over our code with flow control structures like conditional statements and loops. We will then move on to defining our own functions, working with data files, and creating plots in Python.

_images/mindmap.png

Fig. 1 Mind map of concepts covered by this book.#

While a first encounter with programming may be intimidating, we would like to invite you to keep the following in mind: programming is a learned skill, just like driving a car or playing a piano. That means that there is no inherent predisposition to be good at programming. In other words, everyone can master programming as long as they put sufficient time and effort into it. Because programming is a skill, the best way to learn it is by practicing. Therefore, do not hesitate to write code and make mistakes - that is the best way to learn.

Your journey into the world of programming starts here. We hope you will find it equal parts useful and fun!

Important

Help us improve this material! If you notice typos or mistakes in the book, or if you have any suggestions for book improvement, please let us know via this Google form.

Authors, references, and licensing#

Authors#

Book author: Nikolina Šoštarić

Contributors: Margreet Docter, Johan Kramer, Freek Pols, Gary Steele, Joyce Sung, Miyase Tekpinar, Lisa Warners, Verena Zinschitz

Content sources#

[1] Gary Steele, Freek Pols: TU Delft BSc Applied Physics Lab course

These materials served as a foundation for several sections of this book. Depending on the context, their integration varied as follows:

  • In some sections, much of the original phrasing is retained, with occasional rewording or the addition of supplementary material to align with the broader narrative of this book.

  • In other instances, examples from the original materials were replaced with new ones tailored to the specific needs of nanobiology.

  • There are also sections where individual paragraphs were incorporated — either verbatim, rearranged, or modified — and complemented with significant additional content.

The following sections of the book include content derived (in part) from these materials: 3.1, 4.1 - 4.5, 5.1, 6.1 - 6.2, 7.1 - 7.4, 8.1 - 8.2, 9.1 - 9.2, 10.1 - 10.2.

[2] Mario Negrello, Gary Steele: TU Delft BSc Nanobiology Computational Science Jupyter notebooks

The book section 6.3 includes content derived in part from these materials.

[3] PEP 8 Style Guide for Python Code

These materials were the foundation for the book section 5.2.

[4] Pseudocode in Python

The book section 6.4 was inspired by this material.

[5] pandas documentation

Images and text from pandas documentation were used in the book section 9.3.

Licensing#

This material is licensed under a Creative Commons Attribution 4.0 International License unless otherwise stated.

Creative Commons License