💡 What You'll Learn
Lists store multiple items in a single variable. Use square brackets [] to create a list. Items are ordered and indexed starting from 0.
lists.py
1fruits = ["apple", "banana", "cherry"]
2print(fruits[0]) # First item
3print(fruits[-1]) # Last item
📺 Try the list!
🍎 apple
🍌 banana
🍒 cherry
Click to get an item!
🎯 Your Challenges
1Get Last Item
Use index -1 to get the last item
2Add an Item
Add "grape" to the list using append()
3List Length
Use len() to find how many items in the list
📚 What You Learned
- Lists use square brackets:
[] - Items are indexed starting from 0
list[-1]gets the last item- Lists can hold any type of data