In this tutorial, you will learn to manipulate vectors and matrices in Python using both nested lists and NumPy arrays. We will explore from basic operations to more advanced ones. To ensure you understand both ways of working with data in Python, we will divide the project into two parts:
- Pure Python: We will use nested lists to represent and operate with vectors and matrices.
- NumPy: You will learn to work with arrays, which facilitates many operations and optimizes performance.
By the end of this tutorial, you will be able to perform calculations with vectors and matrices in Python efficiently and understand when it is better to use each approach.
You can start these exercises in a few seconds by clicking on: Open in Codespaces (recommended) or Open in Gitpod.
Once you have VSCode open, the LearnPack exercises should start automatically. If this does not happen, you can try starting the exercises by typing this command in your terminal:
$ learnpack start
- Make sure to install LearnPack, node.js version 22.14.0, and Python version 3+. Here is the command to install LearnPack:
$ npm i @learnpack/learnpack@2.1.20 -g && learnpack plugins:install @learnpack/python@1.0.0
- Clone or download this repository to your local environment.
$ git clone https://github.com/4GeeksAcademy/linear-algebra-in-python-and-numpy.git
$ cd linear-algebra-in-python-and-numpy
Note: Once the download is complete, you will find the "exercises" folder containing all the exercises.
- Initialize the tutorial by running the following command at the same level as your learn.json file:
$ pip3 install pytest==6.2.5 pytest-testdox mock
$ learnpack start
Each exercise is a small Python application that contains the following files:
- app.py: Represents the Python entry file that will be executed by the computer.
- README.md: Contains the exercise instructions.
- test.py: Contains the test script for the exercise (you do not need to open this file).
Note: These exercises have automatic grading. The tests are very rigid and strict; my recommendation is not to pay too much attention to the tests and use them only as a suggestion, or you might get frustrated.
This project follows the all-contributors specification. All contributions are welcome!
This and many other exercises are built by students as part of the 4Geeks Academy Coding Bootcamp by Alejandro Sánchez and many other contributors. Find out more about our Full Stack Developer Course, and Data Science Bootcamp.