Skip to content

2b #15

Description

@legend17-dot

my_list = [10, 20, 30, 40]

Display the list

print("Initial list:", my_list)

Append (add element at the end)

my_list.append(50)
print("After append:", my_list)

Insert (add element at a specific position)

my_list.insert(2, 25)
print("After insert:", my_list)

Delete an element using remove()

my_list.remove(20)
print("After delete (remove 20):", my_list)

Pop an element (removes last element)

popped_item = my_list.pop()
print("Popped element:", popped_item)
print("After pop:", my_list)

Display the list

print("Current list:", my_list)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions