Quick actions

cmd+k|ctrl+k

Navigation

Languages

list

Snippet info

Language

Python

Visibility

public

Author

narutouzumakiramen18

Created

2026-05-06T07:24:28.206045Z

Updated

2026-05-06T15:36:05.763488Z

# List methods - part 1

basket = [1,2,3,4,5]

# len - built-in function

# print(len(basket))

# adding an object into the list at the end
basket.append(1)
print(f"append method: {basket}")

# inserting an object, we can insert at a specific index!
# I am adding the obj 10 at the first index.

basket.insert(1, 10)
print(f"insert method: {basket}")

# extending - instead of an item/obj this method takes iterables

basket.extend([100,200])
print(f"extend method: {basket}")

# pop - removes an object from the end'
basket.pop()
print(f"pop method: {basket}")

# remove - we can give it a value that is present inside the list to remove from the list
basket.remove(10)
print(f"remove method: {basket}")

# End
INFO