This notebook demonstrates:
- How to use
numpyfor array operations. - A comparison of performance between native Python lists and
numpyarrays.
- Importing libraries: Initializes
numpyandtime. - Zipping two lists: Shows how
zipcan be used to combine two lists into pairs. - Performance comparison: Measures and prints the execution time for adding two large lists and two large
numpyarrays. - Conclusion: Highlights that
numpyperforms faster than native Python lists for large array operations.
- Python 3.x
- Numpy
pip install numpy- Open this notebook in Jupyter Notebook or JupyterLab.
- Step through the cells and execute them in order.
- The output will show:
- The result of zipping two small lists.
- The time taken to add large native Python lists.
- The time taken to add large
numpyarrays.
This notebook illustrates:
✅ The ease of performing vectorized operations with numpy.
✅ The performance benefits of numpy over pure Python for large datasets.