Welcome to Module 2: Data Structures! After covering the Python fundamentals in Module 1, we now look at how data is stored, organized, and accessed, starting with arrays.
Arrays store items of the same type side by side in memory, making them compact and efficient for numerical data. In Example 2.1, we use Python’s built-in array module to create an array, access items by index, and take a slice.
You’ll learn:
✅ What an array is, and how it differs from a list
✅ How to create an array with a type code (‘i’ for integers)
✅ Indexing: why a[0] is the first item
✅ Slicing: why a[1:4] stops before index 4
✅ Memory: 1,000,000 integers as an array (~4 MB) vs a list (~36 MB)
📌 Code from this video:
python
import array
Create an array of integers
a = array.array('i', [1, 2, 3, 4, 5])
print(a[0])
print(a[1:4])
Output:
1
array(‘i’, [2, 3, 4])
⏱️ Chapters
0:00 Welcome to Module 2: what we’ve covered & what’s next
0:41 What we’ll do
0:54 Importing the array module
1:06 Creating an array
1:23 Indexing & slicing
1:45 Array or list?
2:07 Recap
📚 Module 2 roadmap: Arrays · Lists · Tuples · Dictionaries · Sets
#statistics #datascience #python #machinelearning
On this page of the site you can watch the video online Python Arrays for Beginners: The array Module, Indexing & Slicing | Module 2 · Example 2.1 with a duration of online in good quality, which was uploaded by the user The Data Science Professor 02 November 2026, share the link with friends and acquaintances, this video has already been watched 15 times on youtube and it was liked by 0 viewers. Enjoy your viewing!