Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Preface

The use of computers in everyday life cannot be understated. From the first instants of the day to the final moments before sleep, we are surrounded by appliances and technologies that have some sort of computing mechanism attached to them. While the word “computers” is a much broader term these days when compared to before the early 2000s (i.e., computers often meant a standalone device dedicated for some computing need like a computer workstation), the advent of mobile phones, internet of things (IoT) devices, and “smart” appliances have led to a diversification on what a computer is and can be.

Our society’s dependence on computers extends to professional endeavors, including in the fields of science and engineering. Even simple internet searches on how computing technologies have impacted these fields leads to an overwhelming number of examples. From controlling measurement and processing equipment, analyzing datasets, creating impactful figures and tables, modeling real world phenomena, and solving complex systems using machine learning, our dependency on and benefit from computing devices continues to increase yearly. As these examples highlight, it is important that engineers learn how to program computing devices to solve problems. While full mastery of computer programming is often left to the computer science discipline, this field does not focus on the fundamental physical phenomena that govern many engineering applications. Engineers with computer programming skills act as “knowledge bridges” that connect results collected through the use of computational means to physical phenomena. Therefore, it is now more important than ever for engineers to be proficient in a computer programming language.

There is a plethora of programming languages available these days that satisfy many needs. Currently, one of the most popular languages in general and in the field of science and engineering is Python. It is a free and open-source general purpose programming language that focuses on readability and expandability. Python has proven to be a very capable language for scientific and engineering applications, which has led to the creation of numerous useful code libraries. These “scientific Python” packages now provide the ability to perform mathematical operations and process data arrays with the NumPy and Panda libraries, visualize data with the Matplotlib library, communicate with instruments with the PyVISA library, design experiments and acquire data with the PyMeasure library, analyze images with the scikit-image library, and solve complex problems using machine learning-based techniques with the PyTorch library. Furthermore, it is currently estimated (as of August 2026) that there are at least 600,000 Python libraries available, which includes many scientific-focused libraries. This combination of capability and availability makes the Python programming language a powerful tool for solving engineering-based problems.

This guide is designed to be a starting point for anyone who wants to learn Python with a focus on science and engineering applications. We have written this guide assuming that the reader has no background experience in coding but has a high school education level in mathematical concepts. This guide has been designed such that a reader will not be a Python expert after completing these lessons, but rather should be proficient in reading Python code, understand how to make their own small Python programs, be comfortable in reading error messages, and know how to search for new functionality. We have written this guide using a long-form, paragraph-like writing style that many scientists and engineers are accustomed too. This style of write provides us way to fully articulate and detail the workings of many Python commands. Each lesson contains usable code blocks that the reader can actively follow and execute on their own computer. In addition to these blocks of code, we have included numerous example problems with solution to help further instruct many of the basic tenants in Python programming for scientific and engineering applications.

We treat this guide as a living document in which we are actively fixing mistakes, correcting grammatical errors, and adding new content. Even so, there have been three major content-based versions of this guide over the past four years. Our first version of the guide came out in late December of 2022 to support undergraduate and graduate students in our department (The Department of Chemical Engineering and Materials Science at the University of Minnesota) who were interested in learning Python to analyze data or control instrumentation. This original version was also used as primary and secondary reading material for various numerical methods and programming-focused courses in our department. The second version, which was released in the summer of 2024, added more than 30 example problems (with solutions) that we believe are relevant for both the chemical and materials engineering disciplines. The current version you are seeing is the result of our experiences teaching a pilot course on using the Python programming language to control scientific instrumentation. This experience allowed us to fully test how well our online guide can support a split undergraduate and graduate level course taken by both chemical and materials engineers. This experience resulted in a major reworking of the overall structure of the guide and a significant expansion in topics dealing with working with files, object-oriented programming, and plotting.

We hope this guide can be used as a centralized, standard starting point for Python education. Lessons build off one another, so it is recommended that a beginner in language starts with the first lesson. Regardless if this is your first programming language, or you have programmed before, we hope you enjoy these lessons on your path to learning the basics of Python for scientific applications. When you are ready, start the first lesson that covers how to get Python running on your computer, so you can begin your journey to learn about this powerful programming language.

- Mike Manno and Dan McDonald (August 2026)