Quick actions

cmd+k|ctrl+k

Navigation

Languages

List Methods 2

Snippet info

Language

Python

Visibility

public

Author

harshdeepsaini2757

Created

2025-11-03T23:15:57.891266Z

Updated

2025-11-03T23:15:57.891266Z

# List Methods 2
basket = ['a','b','c','d','e','d']

print('n' in basket)
print(basket.count('d'))

basket = ["Banana", "Apples", "Oranges", "Blueberries"]
# 1. Remove the Banana from the list
basket.remove('Banana')
# 2. Remove "Blueberries" from the list.
basket.remove('Blueberries')
# 3. Put "Kiwi" at the end of the list.
basket.append('Kiwi')
# 4. Add "Apples" at the beginning of the list
basket.insert(0, 'Apples')
# 5. Count how many apples in the basket
basket.count('Apples')
# 6. empty the basket
basket.clear()
print(basket)



INFO