Adding and Removing Items
Use append and remove to change a list.
Changing Your List 🔧
Hello, list boss! 👑 Lists are not stuck forever. We can add new things and remove old ones anytime! 🎉
Adding with append() ➕
Use .append() to ADD a new item to the END of a list. Like dropping a toy in the basket! 🧺
fruits = ["apple", "banana"]
fruits.append("cherry")
print(fruits)All lessons in this course
- What Is a List?
- Getting Items by Position
- Adding and Removing Items
- Looping Through a List