CognitoCoding All posts
1 July 2026 3 min read by Eris Taylor

What Is a List in Coding? (How to Store More Than One Thing at a Time)

pythonlearn-to-codelistsbeginnerscoding-concepts

Imagine you're building a quiz game. Your player answers 5 questions. How do you store those scores?

You could write this:

score1 = 8
score2 = 6
score3 = 9
score4 = 7
score5 = 10

That works — until you have 50 questions. Or a leaderboard with 500 players. Or you need to find the highest score without checking every variable by hand.

That's exactly where a list comes in.

What is a list?

A list is a variable that holds multiple values — all in one place, in order.

Instead of five separate variables, you get one:

scores = [8, 6, 9, 7, 10]

One name. Five values. Stored in order, ready to use.

How to make a list in Python

Square brackets, values separated by commas.

# A list of numbers
scores = [8, 6, 9, 7, 10]

# A list of names
players = ["Aiden", "Bella", "Carlos"]

# Lists can hold any type
mixed = [42, "hello", True, 3.14]

Lists can hold numbers, text, True/False values — even other lists. The type doesn't matter. What matters is the order.

How to get things out of a list

Every item in a list has a position — called an index. The first item is at position 0, not 1. This catches almost every beginner at least once.

players = ["Aiden", "Bella", "Carlos"]

print(players[0])  # Aiden
print(players[1])  # Bella
print(players[2])  # Carlos

Want the last item without knowing how long the list is? Use -1:

print(players[-1])  # Carlos — last item, counting from the end

How to add and remove things

Lists aren't frozen. You can change them as your program runs.

inventory = ["sword", "shield"]

# Add an item
inventory.append("potion")
print(inventory)  # ["sword", "shield", "potion"]

# Remove an item
inventory.remove("shield")
print(inventory)  # ["sword", "potion"]

.append() adds to the end. .remove() takes out the first match it finds. Those two alone will cover most of what you need when you're starting out.

Where lists show up in real builds

Once you know lists, you'll spot them everywhere.

In a Snake game — the snake's body is a list. Every time the snake eats a pellet, a new segment gets appended. The tail segment gets removed. The list stays the right length automatically. Coding Snake in Scratch uses exactly this pattern — even in block code, the concept is the same.

In the Farmer Was Replaced — the drone reads a list of crops to harvest, processes each one in turn, and moves on. The harvest schedule is a list. The grid coordinates are stored in lists.

In any quiz or game — questions, answers, player names, scores, leaderboard entries. All lists.

When vibe coding with AI — when you ask an AI to "loop through all the items" or "check each one", it almost always generates a list behind the scenes. Knowing what a list is means you can read what the AI actually built.

What comes next

Lists on their own are useful. But they become really powerful when you combine them with loops.

A loop that runs through a list — checking each item, doing something with each one — is one of the most-used patterns in all of coding. You can calculate totals, find the highest value, print every name, check every score.

We've already covered loops. If you haven't read that post yet, start there — then come back here and put the two together.

The Short that started this

This post is the long-form version of the One Concept, One Board Short on Lists. If you want the 60-second version first, watch it here — then come back for the code:


One variable. Many values. In order.

Learn the index trick (start at 0, not 1), add .append() and .remove() to your toolkit, and you'll have everything you need to build games, quizzes, and programs that actually remember things.