Collections of anything!
Learn how to store multiple items in a single list. Make a list of names, numbers, or anything else!
A list is a variable that can hold many values at once. Instead of making ten variables for ten names, you make one list that holds all ten. Lists keep things organized and easy to find!
๐ก Think of it like this:
Think of a list like a lunch tray with compartments. Each compartment holds a different food item, but they are all on the same tray. You can point to any compartment by its position.
Lists are used everywhere โ shopping lists, playlists, high score tables, inventories. Any time you need to keep track of multiple things, a list is the right tool.
Where you see this in real life:
In Python, the first item in a list is at index 0, not 1! This is called "zero-based indexing" and most programming languages do it this way.
A list is a variable that can hold many values at once. Instead of making ten variables for ten names, you make one list that holds all ten. Lists keep things organized and easy to find!
Lists use square brackets []and items are separated by commas.
Lists use square brackets []Each item in a list has a position number called an index. Python starts counting from 0! So the first item is at index 0, the second at index 1, and so on.
Click โถ Run to see the output!You can use a for loop to go through every item in a list!
Click โถ Run to see the output!Use len()to find out how many items are in a list.
Click โถ Run to see the output!If a list has 5 items, what is the index of the LAST item?