Lesson 6 of 13

Arrays: Super Lists! 📋

Instead of storing one thing, an array stores MANY things — all in one place, all in order. Think of it like a row of labelled lockers!

[0]
🍎
apple
[1]
🍌
banana
[2]
🍊
orange
[3]
🍇
grapes
[4]
🍓
cherry
🤔 What is an Array?

One Variable That Holds Everything!

No more making 10 variables — one array does the job!

When I first built a game, I needed to store 5 player names. I made 5 separate variables. My teacher said — “There’s a much better way!” She showed me arrays. One line. All five names. I was amazed! 😄

😰 Without Arrays
player1 = "Ali"
player2 = "Sara"
player3 = "Zain"
player4 = "Mia"
player5 = "Leo"
5 variables — messy!
😎 With an Array!
players = [
  "Ali", "Sara",
  "Zain", "Mia",
  "Leo"
]
1 array — clean! 🎉

🔢 How to Get Items

Every Item Has an Index Number!

Use the number to grab exactly what you need!

Each slot in an array has a number called an index. Use it like an address — tell the computer which slot to look in and it gives you what’s inside! Click any slot below!

[0]
🐶
“dog”
[1]
🐱
“cat”
[2]
🐟
“fish”
[3]
🐦
“bird”

👆 Tap any slot to see what the code looks like!

🤯

Fun Fact: In most coding languages, arrays start counting from ZERO (0) — not one! So the first item is always [0], the second is [1], and so on. A bit weird at first — but you’ll get used to it fast! 😄


🎮 Build Your Own Array!

Interactive Array Builder!

Add items, remove them, watch the code update live!

🛒 My Shopping List Array

Add items — click ✕ to remove — watch the code change!

Your array is empty!
Add some items below 👇
my_list = [] ← your array will appear here!

🌍 Arrays in Real Life

You See Arrays Everywhere!

Any time you have a list — that’s an array in disguise!

🎵

Music Playlist

Your playlist is an array of songs — played in order, one after another!

[0]”Song1″ [1]”Song2″ [2]”Song3″
🏆

Game Leaderboard

High scores stored in order — best score first, then second, then third!

[0]1000 [1]850 [2]720
📅

Days of the Week

7 days stored as an array — index 0 is Monday, index 6 is Sunday!

[0]”Mon” [1]”Tue” [2]”Wed”
👾

Game Enemies

All enemies on screen are in an array — the game loops through each one every second!

[0]👾 [1]👾 [2]👾

⚡ What Can You Do With Arrays?

3 Key Array Operations!

Add, remove, and count — the three things every coder does!

Add Items — append()

Use append() in Python to add a new item to the end of the array. Like adding something to the bottom of your shopping list!

Before
fruits = ["apple","banana"]
After
fruits = ["apple","banana","orange"]
fruits.append(“orange”)

Remove Items — remove()

Use remove() to delete a specific item from the array. Like crossing something off your shopping list!

Before
fruits = ["apple","banana","orange"]
After
fruits = ["apple","orange"]
fruits.remove(“banana”)
📏

Count Items — len()

Use len() to find out how many items are in your array. Super useful when you need to loop through everything!

Array
friends = ["Ali","Sara","Zain"]
Result
len(friends) → 3 friends!
len(friends) # → 3

🧠 Quick Quiz!
🎯 Arrays Quiz

4 questions · pick an answer to check!

⭐ Remember This!

📋

Arrays are lists that hold many items in one place

0️⃣

Counting always starts at zero [0], not one!

Use append() to add items to the end

📏

Use len() to count how many items you have