Count, Collect, and Organize

Learn how to store, add to, and loop through lists.

Sometimes, we need to keep track of many values, like scores, names, or steps. Instead of using a new variable for each one, we can use a list to store them all together in a neat, single container.

They let us store and organize many values in one place, so our code can handle more with less effort.

Creating a list of values

A list is like a container containing multiple items—such as numbers, words, or other lists. We can create a list like this:

Get hands-on with 1400+ tech skills courses.