Tutorial
List Operations in Python
Lists in Python are mutable, meaning you can modify them after creation. You can add items, remove items, and check their length using built-in functions.
Appending Items
The append() function adds a new item to the end of the list.
Removing Items
The remove() function removes the first occurrence of the specified item from the list.
Note: If the item does not exist, Python will raise a ValueError.
Checking Length
The len() function returns the number of items in the list.
Summary
append(item)– Adds an item at the end of the listremove(item)– Removes the first occurrence of the itemlen(list)– Returns the number of items in the list