Learn1 of 3
What Are Lists?
A list is a special type of variable that allows us to store multiple values together in one place. For example, we can create a list of fruits like this:
fruits = ['apple', 'banana', 'cherry']
We can access each fruit in the list by its position, starting from 0. So, 'fruits[0]' gives us 'apple', and 'fruits[1]' gives us 'banana'. We can also add new items to our list using 'fruits.append('grape')' to add 'grape' at the end. If we want to remove an item, we can use 'fruits.remove('banana')' to take 'banana' out of the list. Lists are super helpful for keeping track of collections of related data!