Version 1.0 - February, 2026. Monterrey
This NumpyTutorial is a hands-on guide designed to introduce you to NumPy and to good programming practices in Python. Throughout the material, you will find guided examples and a series of exercises and test cases that encourage you to actively practice what you learn, while you perform basic linear algebra operations and write more reliable code through testing and debugging. It is best used by working through the sections in order, running the examples, and solving the exercises yourself.
This tutorial is organized into three main parts:
-
Part 1: Introduction to NumPy
- Python Basics
- Using Google Colab for This Tutorial
- Basic Structure of Codes Used in This Tutorial
- NumPy Arrays
- Shape of Numpy Arrays
- Accessing NumPy Arrays
- Operations on NumPy Arrays
- Linear Algebra
- Saving and Loading Data with
.npyand.npzFiles
-
Part 2: Introduction to Assert Statements and Testing
-
Part 3: Debugging Your Code
-
Wrap-Up and Next Steps
To complete your training and receive credit, you must work through these sections and complete the two mandatory assessment notebooks:
numpy_python_basics.ipynb(Python basics)numpy_tutorial_exercises.ipynb(Numpy exercises)
To avoid local installations and focus exclusively on coding, these notebooks are designed to be performed in Google Colab.
The purpose of this notebook is to help you:
- Become comfortable using NumPy for numerical computing
- Understand and apply basic linear algebra operations in Python
- Learn how to test your code using
assertstatements and NumPy’s testing tools - Develop debugging skills to find and fix errors more effectively
- Build confidence in writing correct, readable, and maintainable scientific Python code
This tutorial is meant to be a learning resource, not a final reference.
Flavio F. Contreras-Torres
Tecnológico de Monterrey
Monterrey, Mexico
v.1.0 - February 2026
The content of this tutorial itself is licensed under the terms and conditions of the Creative Commons Attribution (CC BY 4.0) license, and the underlying source code used to format and display that content is licensed under the MIT license. See the LICENSE files for full details.
If you use or adapt this material, please provide appropriate credit to the original authors and repository:
NanoBiostructures Research Group
GitHub: https://github.com/NanoBiostructuresRG