From Variables to
"Magic Boxes"

Stop creating 100 separate variables (`score1`, `score2`...). Upgrade your toolkit with Lists and Matrices to handle massive datasets with a single line of code.

The Old Way (Painful)
score1 = 50
score2 = 80
score3 = 45
# ... 97 lines later 😩
UPGRADE
The List Way (Magic)
scores = [50, 80, 45, ...]
# Holds millions! 🚀
PHASE 1

The List Engine

Lists are dynamic. You can add, remove, and insert items on the fly. Interact with the "Magic Box" below to see how methods like .append() and .pop() change the data structure.

.append(x)

Adds to the end.

.insert(i, x)

Jumps the queue.

.pop()

Result: -

Removes & returns last item.

.remove(x)

Deletes first occurrence.

PHASE 2

The Slicing Lab 🔪

Unlock the power to cut, copy, and reverse data with the syntax:
[start : stop : step]

Reverse [::-1]

Instantly flips the array backwards.

Step Jump ::2

Takes every 2nd item (0, 2, 4...).

Interactive Slicer

:
:

Result

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
PHASE 3

List Comprehension (LC)

Create new lists in a single line. It's cleaner, faster, and more "Pythonic". See how LC filters and transforms data instantly compared to traditional loops.

The Syntax

[ expr for x in list if cond ]

Visualizing Data Transformation

Displaying raw student scores.

PHASE 4

The Matrix (2D Lists)

Data isn't always linear. Use matrix[row][col] for grids, maps, and tables.

👾 Grid Traversal

Click two cells to calculate Manhattan Distance.
Formula: |r1 - r2| + |c1 - c2|

START
-
DISTANCE
0
END
-

🔄 Rotation Logic

Rotating a matrix 90° clockwise involves remapping indices.
new_c = N - 1 - old_r

⚠️ Shallow Copy Warning

Never use [[0]*N]*N. It links rows together!
Always use Nested List Comprehension.