May 7, 2025
[].fruits[0] for the first element.fruits[0:3].for fruit in fruits:.append(): Adds element at the end.remove(): Removes first occurrence of a value.insert(index, element): Inserts an element at a specified index.sort(): Sorts the list.reverse(): Reverses the order of the list.clear(): Removes all elements.count(value): Counts occurrences of a value.index(value): Returns index of the first occurrence.len(list).in operator, e.g., 'apple' in fruits.{}.add(element): Adds an element.remove(element): Removes a specific element.pop(): Removes a random element.clear(): Removes all elements.in operator.len(set).().fruits[0].count(value): Counts occurrences of a value.index(value): Returns index of the first occurrence.len(tuple).in operator.